import java.io.*;
import java.util.*;

class dwite2
{
    public static void main (String [] args) throws IOException 
    {
    	BufferedReader f = new BufferedReader(new FileReader("DATA2.txt"));
    	PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("OUT2.txt")));
    	
    	
    	
		String [] str= new String[5];

		for(int i=0; i<5; i++)
		{
			str[i]= f.readLine();

			StringTokenizer s= new StringTokenizer(str[i]);

			int a= Integer.parseInt(s.nextToken());

			String b= s.nextToken();

			while(a>=10)
			{

				String c= String.valueOf(a);

				int temp=0;
		
				for(int j=0; j<c.length(); j++)
				{
					temp+= Integer.parseInt(c.charAt(j)+"");
				}
	
			a=temp;
	
			}
	
			if(a==con(b))
				out.println("match");
			else
				out.println("error");
	}
	
	out.flush();
	System.exit(0);
}

public static int con(String a)
{
	String abc= "0ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int index=0;
	
	for(int i=0; i<27; i++)
	{
		String b= abc.charAt(i) +"";

		if(b.compareTo(a)==0)
			return i;
	}
	return -1;	
}

}	

