#include <iostream>
int main( void )
{
using namespace std ;
cin.exceptions( ios::badbit | ios::eofbit | ios::failbit ) ;
while( true )
{
try
{
char c ;
c = cin.get() ;
cout << c ;
}
catch( ios::failure & e )
{
if( cin.bad() )
{
cout << "bad" << endl ;
}
if( cin.eof() )
{
cout << "eof" << endl ;
}
if( cin.fail() )
{
cout << "fail" << endl;
}
break ;
}
}
return 0 ;
}