#include<iostream>
#include<vector>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<pair<char,int> >v(n);
	int o,a,b,ab;
	cin>>o>>a>>b>>ab;
	int ou=0,au=0,bu=0,abu=0;
	for(int i=0;i<n;i++){
		cin>>v[i].first>>v[i].second;
		if(v[i].first=='O') ou+=v[i].second;
		if(v[i].first=='A') au+=v[i].second;
	}
	cout<<"moguce"<<endl;
	int p=1,q=0,r=0,s=0;
	cout<<p<<" "<<q<<" "<<r<<" "<<s<<endl;
	cout<<r<<" "<<q<<" "<<p<<" "<<s<<endl;
	s=2;
	cout<<p<<" "<<q<<" "<<r<<" "<<s<<endl;
	return 0;
}