#include<iostream>
using namespace std;
class Aerror{};
class Berror{};
void f(int i) throw(Aerror,Berror);
void main()
{
	for(int i=0;i!=2;++i)
	{
		try
		{
			f(i);
		}
		catch(Aerror&)
		{
			cout<<"A error"<<endl;
		}
		catch(Berror&)
		{
			cout<<"B error"<<endl;
		}
	}
}
void f(int i)
{
	switch(i)
	{
	case 0: throw Aerror();
	case 1: throw Berror();
	default:
		cout<<"Over!"<<endl;
	}
	
}

