#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <queue>
#include <cassert>

using namespace std;

//------------------------------------------------------------------------------------------------------------------------
// CONSTANTS
//------------------------------------------------------------------------------------------------------------------------

#define PI          3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803   /* all from memory! */
#define PHI         1.6180339887498948482045868343656   /* = (sqrt(5)+1)/2  */
#define MAXINT      0x7fffffff                          /* for a signed integer */
#define EPSILON     0.00000001                          /* for floating-point value comparison */
#define MAXDOUBLE   1.79769313486231570e+308

#define NORTH       0
#define EAST        1
#define SOUTH       2
#define WEST        3

#define MS(a,b)     memset(a, b, sizeof(a))
#define FOR(a,b,c)  for (a = (b); a < (c); ++a)

const int fact[] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600 }; // up to 12!
const int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};  // lengths of each month


//------------------------------------------------------------------------------------------------------------------------
// GLOBAL VARIABLES
//------------------------------------------------------------------------------------------------------------------------

int dc[] = {  0,  1,  0, -1 };
int dr[] = { -1,  0,  1,  0 };
int cmax = -MAXINT;
int cmin = MAXINT;


//------------------------------------------------------------------------------------------------------------------------
// FUNCTIONS/CLASS DEFINITIONS
//------------------------------------------------------------------------------------------------------------------------



string toString(int num)
{
    char buffer[20];
    sprintf(buffer, "%d", num);
    return string(buffer);
}

int toInt(string p)
{
    return atoi(p.c_str());
}

string numToL;
char check;




//------------------------------------------------------------------------------------------------------------------------
// MAIN PROGRAM EXECUTION
//------------------------------------------------------------------------------------------------------------------------
int main()
{
    ifstream fin("data2.txt");
    ofstream fout("out2.txt");
    int i = 0, j = 0, k = 0;
    int num, n1, n2, n3;
    string str;

    for (i = 0; i < 5; ++i)
    {
        fin >> numToL >> check;
        int sum = 0;
        while (sum <= 0 || sum >= 10)
        {
            sum = 0;
            for (j = 0; j < numToL.length(); ++j)
            {
                sum += numToL[j]-'0';
            }
            numToL = toString(sum);
        }
        if (sum == check-'A'+1)
            fout << "match";
        else
            fout << "error";
        fout << "\n";
    }











    return 0;
}




