#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef long double LD;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) (a).begin(),(a).end()


struct Edge
{
    int to,from,cost;
    Edge(int to_,int from_,int weight_):to(to_),from(from_),cost(weight_)
    {}

};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

const Graph reverse_edge_Graph(const Graph& g)
{
    Graph rg(g.size());
    for(auto&& es : g)
        for(auto&& e : es)
            rg[e.to].push_back(Edge(e.from,e.to,e.cost));
    return rg;
}

const tuple<vector<int>,vector< vector<int>>> SCC(const Graph& g) //StronglyConnectedComponent
{
    const int n = g.size();
    Graph rg(reverse_edge_Graph(g));
    vector<int> vs;
    vector<char> reach(n);  //vector<bool>
    vector<vector<int> > scc;
    vector<int> scc_vectormap(n);

    function<void(const int)> dfs = [&](const int v)
    {
        reach[v]=1;
        for(auto&& e : g[v])
            if(!reach[e.to]) dfs(e.to);
        vs.push_back(v);
    };
    function<void(const int, const int)> rdfs = [&](const int v, const int k)
    {
        reach[v]=1;
        scc[k].push_back(v);
        scc_vectormap[v]=k;
        for(auto&& e : rg[v])
            if(!reach[e.to]) rdfs(e.to, k);
    };

    for(int i=0;i<n;i++)
        if(!reach[i]) dfs(i);
    fill(reach.begin(), reach.end(), 0);
    int k=0;
    for(int i=vs.size()-1;i>=0;i--)
        if(!reach[vs[i]]) 
        {
            scc.push_back(vector<int>());
            rdfs(vs[i], k++);
        }
    return tuple<vector<int>, vector<vector<int>> >(scc_vectormap, scc);
}

const Graph DAG_from_SCC(int DAG_size,Graph& g, vector<int>& scc_vectormap)
{
    Graph dag(DAG_size);
    for(auto&& es : g)
        for(auto&& e : es)
        {
            if(scc_vectormap[e.from]==scc_vectormap[e.to]) continue;
            dag[scc_vectormap[e.from]].push_back(Edge(scc_vectormap[e.to], scc_vectormap[e.from], 0));
        }
    return dag;
}





vector<string> s(500);

int l=0;
int m=0;
int p,q,op;
bool nt;

map<string, int> val;
int valind=1;
void parse()
{
	int parenth=0;
	int indp=0;
	int np=0,nq=0,n=0;
	int phase=0;
	int sr=0,sl=-1;
    while(l<s[m].size())
    {
        if(s[m][l]=='~')
        {
			n++;
			if(phase==2)
				nq++;
        }
        else if(s[m][l]=='(')
        {
        }
        else if(s[m][l]==')')
        {
			if(phase==1)
			{
				parenth++;
			}
        }
        else if(s[m][l]=='&')
        {
			op=1;
			phase++;
        }
        else if(s[m][l]=='|')
        {
			op=2;
			phase++;
        }
        else if(s[m][l]==';')
        {
			break;
        }
        else
        {
            if(sl==-1)
            {
                sl=l;
				phase++;
            }
            sr++;
            
            if(!((('A'<=s[m][l+1]&&s[m][l+1]<='Z')||
            ('a'<=s[m][l+1]&&s[m][l+1]<='z'))&&
            s[m][l+1]!=';'))
            {
                string t=s[m].substr(sl,sr);
                sl=-1;
                sr=0;
                if(val.find(t)==val.end())
                {
                    val[t]=valind;
                    valind++;
                }
                p=q;
				if(phase==1)
					indp=l;
                q=val[t];
            }
        }

        l++;
    }
	int cnt=0;
	for(int i=indp;i>=0;i--)
	{
		if(s[m][i]=='(')
		{
			cnt++;
		}
		if(s[m][i]=='~')np++;
		if(cnt>parenth)
		{
			break;
		}
	}
	if(np%2==1)
	{
		if(phase>1)
			p*=-1;
		else
			q*=-1;
	}
	if(nq%2==1)
	q*=-1;
	n-=np+nq;
	nt=n%2==0;
}


int conv(int p)
{
    return p<0?(-p)*2+1:p*2;
}
int main()
{
	int n,mm;
	cin>>n>>mm;

    Graph g(2+mm*2);
    
	REP(i,n)
        cin>>s[i];
	
    REP(i,n)
    {
		l=0;
        m=i;
        p=0;q=0;op=0;nt=0;
        parse();

        if(nt==0)
        {
            if(op==1)
            {
                nt=1;
                op=2;
                int t=p;
                p=-q;
                q=-t;
            }
            else if(op==2)
            {
                nt=1;
                op=1;
                int t=p;
                p=-q;
                q=-t;
            }

        }
		//cout<<nt<<p<<op<<q<<endl;
        if(p==0)
        {
            g[conv(-q)].push_back(Edge(conv(q), conv(-q), 1));
        }
        else
        {
            if(op==1)
            {
                g[conv(-q)].push_back(Edge(conv(q), conv(-q), 1));
                g[conv(-p)].push_back(Edge(conv(p), conv(-p), 1));
            }
            if(op==2)
            {
                g[conv(-p)].push_back(Edge(conv(q), conv(-p),  1));
                g[conv(-q)].push_back(Edge(conv(p), conv(-q), 1));
            }
        }
    }

	auto sccret=SCC(g);
	auto vv=get<1>(sccret);
	bool ans=1;
	//cout<<vv.size()<<endl;
	REP(i,vv.size())
	{
		sort(ALL(vv[i]));
		REP(j,vv[i].size()-1)
		{
			//cout<<vv[i][j]<<" ";
			if(vv[i][j+1]-vv[i][j]==1 && vv[i][j]%2==0)
			{
				ans=0;break;
			}
		}
		//cout<<vv[i][vv[i].size()-1]<<endl;
		if(!ans)break;
	}
	//auto dag=DAG_from_SCC(get<1>(sccret).size(), g, get<0>(sccret));

	if(ans)
		cout<<"accept"<<endl;
	else
		cout<<"reject"<<endl;
}

Measured memory_bytes: 3392