#include <cstdio>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl;
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define foreach(i,c) for(__typeof__((c).begin()) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

struct Edge{
	int src,dst;
	Edge(){}
	Edge(int s,int d):src(s),dst(d){}
};
typedef vector<vector<Edge> > Graph;
ostream& operator<<(ostream& os,const Edge& e){
	return os<<'('<<e.src<<','<<e.dst<<')';
}

struct Term{
	int v1,v2;
	char op;
	Term(int v1,char op='#',int v2=-1):v1(v1),op(op),v2(v2){}
};
ostream& operator<<(ostream& os,const Term& t){
	return os<<t.v1<<t.op<<t.v2;
}
typedef pair<int,Term> Parsed; // (index,(var1,var2))

Parsed parse_expr(const string& s,int i,int m,map<string,int>& ntoi);

Parsed parse_term(const string& s,int i,int m,map<string,int>& ntoi)
{
	//printf("parse_term(s,%d)\n",i);
	if(s[i]=='('){
		Parsed p=parse_expr(s,i+1,m,ntoi);
		p.first++;
		return p;
	}
	if(s[i]=='~'){
		Parsed p=parse_term(s,i+1,m,ntoi);
		if(p.second.v2==-1){
			(p.second.v1+=m)%=2*m;
		}
		else{
			(p.second.v1+=m)%=2*m;
			(p.second.v2+=m)%=2*m;
			p.second.op=p.second.op=='&'?'|':'&';
		}
		return p;
	}
	assert(isalpha(s[i]));
	
	int j=i;
	for(;j<s.size() && isalpha(s[j]);j++)
		;
	string name=s.substr(i,j-i);
	if(!ntoi.count(name))
		ntoi.insert(mp(name,ntoi.size()));
	return Parsed(j,Term(ntoi[name]));
}

Parsed parse_expr(const string& s,int i,int m,map<string,int>& ntoi)
{
	//printf("parse_expr(s,%d)\n",i);
	Parsed p=parse_term(s,i,m,ntoi);
	i=p.first;
	if(s[i]!='&' && s[i]!='|') return p;
	
	char op=s[i++];
	Parsed q=parse_term(s,i,m,ntoi);
	i=q.first;
	return Parsed(i,Term(p.second.v1,op,q.second.v1));
}

void DFS(const Graph& g,int v,vi& vis,vi& order)
{
	if(vis[v]) return;
	vis[v]=1;
	rep(i,g[v].size())
		DFS(g,g[v][i].dst,vis,order);
	order.push_back(v);
}

vvi StronglyConnectedComponent(const Graph& g)
{
	int n=g.size();
	vi vis(n),order;
	rep(i,n)
		DFS(g,i,vis,order);
	Graph ig(n);
	rep(i,n) foreach(e,g[i])
		ig[e->dst].push_back(Edge(e->dst,e->src));
	fill(all(vis),0);
	vvi res;
	per(i,n){
		if(vis[order[i]])
			continue;
		vi temp;
		DFS(ig,order[i],vis,temp);
		res.push_back(temp);
	}
	return res;
}

int main()
{
	for(int n,m;~scanf("%d%d",&n,&m);){
		vs lines(n);
		rep(i,n){
			char temp[1001]; scanf("%s",temp);
			lines[i]=temp;
		}
		
		int m2=2*m;
		Graph g(m2);
		map<string,int> ntoi; // name -> index;
		
		rep(i,n){
			Parsed p=parse_expr(lines[i],0,m,ntoi);
			Term t=p.second;
			if(t.v2==-1)
				g[(t.v1+m)%m2].push_back(Edge((t.v1+m)%2*m,t.v1));
			else{
				if(t.op=='&'){
					g[(t.v1+m)%m2].push_back(Edge((t.v1+m)%m2,t.v1));
					g[(t.v2+m)%m2].push_back(Edge((t.v2+m)%m2,t.v2));
				}
				else{
					g[(t.v1+m)%m2].push_back(Edge((t.v1+m)%m2,t.v2));
					g[(t.v2+m)%m2].push_back(Edge((t.v2+m)%m2,t.v1));
				}
			}
		}
		
		vvi scc=StronglyConnectedComponent(g);
		
		vi color(m2,-1);
		rep(i,scc.size()) rep(j,scc[i].size())
			color[scc[i][j]]=i;
		
		bool res=true;
		rep(i,m)
			res&=color[i]!=color[i+m];
		puts(res?"accept":"reject");
	}
	
	return 0;
}

Measured memory_bytes: 1416