   import java.util.*;
   import java.lang.*;
   import java.io.*;

    public class Two{
       public static void main(String args[]) throws Exception{
         BufferedReader in = new BufferedReader(new FileReader("DATA2.txt"));
         BufferedWriter out = new BufferedWriter(new FileWriter("OUT2.txt"));
              
         for(int i=0;i<5;i++){
            int one,two,three,four,five,six;
            int sum=0;
            int answer=99;
            String letter= "ABCDEFGHI";
         
         			
            char code;
         
            String str = in.readLine();
          
            code = str.split(" ")[1].charAt(0);          
            str = str.split(" ")[0];
          
            one = Integer.parseInt(str.charAt(0)+"");
            two = Integer.parseInt(str.charAt(1)+"");
            three = Integer.parseInt(str.charAt(2)+"");
            four = Integer.parseInt(str.charAt(3)+"");
            five = Integer.parseInt(str.charAt(4)+"");
            six = Integer.parseInt(str.charAt(5)+"");
         	
         	
         
            sum=one+two+three+four+five+six;
            answer=sum;
            while(answer>=10){
               if(answer>=10){
                  answer=(int)(answer/10)+(answer%10);
					
               }
               else{
                  answer=sum;
               }             
            }
         	
            if(letter.charAt(answer-1)==code){
               out.write("match");
               out.newLine();
            }
            else{
               out.write("error");
               out.newLine();
            }
         }		
              
              
      
         in.close();
         out.close();
      
      }
   }