#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);


bool read_two(string s,int &pos,map<string,bool> &bl);
bool read_one(string s,int &pos,map<string,bool> &bl){
	if(s[pos]=='~'){
		pos++;
		return !read_one(s,pos,bl);
	}else if(s[pos]=='('){
		pos++;
		bool ret=read_two(s,pos,bl);
		assert(s[pos]==')');
		pos++;
		return ret;
	}else if(isalpha(s[pos])){
		string ss;
		while(isalpha(s[pos])){
			ss+=s[pos];
			pos++;
		}
		return bl[ss];
	}else{
		assert(0);
	}
}

bool read_two(string s,int &pos,map<string,bool> &bl){
	bool l=read_one(s,pos,bl);
	if(s[pos]=='&'||s[pos]=='|'){
		char op=s[pos];
		pos++;
		bool r=read_one(s,pos,bl);
		if(op=='&'){
			return l&&r;
		}else{
			return l||r;
		}
	}else{
		return l;
	}
}
struct closure{
	string l,r;
	bool ls,rs;
	closure(string l,string r,bool ls,bool rs):l(l),r(r),ls(ls),rs(rs){}
};
int V;
const int MAX_V=2010;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> vs_;
bool used[MAX_V];
int cmp[MAX_V];

void add_edge(int from,int to){
  G[from].push_back(to);
  rG[to].push_back(from);
}

void dfs(int v){
  used[v] = true;
  for(int i = 0 ; i < G[v].size() ; i++){
    if(!used[G[v][i]])dfs(G[v][i]);
  }
  vs_.push_back(v);
}

void rdfs(int v,int k){
  used[v] = true;
  cmp[v] = k;
  for(int i = 0 ; i < rG[v].size() ; i++){
    if(!used[rG[v][i]])rdfs(rG[v][i],k);
  }
}

int scc(){
  memset(used,0,sizeof(used));
  vs_.clear();
  for(int v = 0 ; v < V ; v++){
    if(!used[v])dfs(v);
  }
  memset(used,0,sizeof(used));
  int k = 0 ;
  for(int i = vs_.size()-1 ; i >= 0 ; i--){
    if(!used[vs_[i]])rdfs(vs_[i],k++);
  }
  return k;
}

int main(){
	int n,m;
	cin>>n>>m;
	vector<closure> closures;
	REP(i,n){
		string s;
		cin>>s;
		string lst,rst;
		int j;
		for(j=0;j<s.size()&&!isalpha(s[j]);j++);
		for(;j<s.size()&&isalpha(s[j]);j++){
			lst+=(s[j]);
		}
		for(;j<s.size()&&!isalpha(s[j]);j++);
		for(;j<s.size()&&isalpha(s[j]);j++){
			rst+=(s[j]);
		}
		bool results[2][2];
		REP(i,2){
			REP(j,2){
				int pos=0;
				map<string,bool> bl;
				bl[lst]=i;
				bl[rst]=j;
				results[i][j]=(read_two(s,pos,bl));
			}
		}
		if(!results[0][0]&&results[0][1]&&results[1][0]&&results[1][1]){
			closures.push_back(closure(lst,rst,true,true));
		}else if(results[0][0]&&!results[0][1]&&results[1][0]&&results[1][1]){
			closures.push_back(closure(lst,rst,true,false));
		}else if(results[0][0]&&results[0][1]&&!results[1][0]&&results[1][1]){
			closures.push_back(closure(lst,rst,false,true));
		}else if(results[0][0]&&results[0][1]&&results[1][0]&&!results[1][1]){
			closures.push_back(closure(lst,rst,false,false));
		}else if(!results[0][0]&&!results[0][1]&&!results[1][0]&&results[1][1]){
			closures.push_back(closure(lst,lst,true,true));
			closures.push_back(closure(rst,rst,true,true));
		}else if(!results[0][0]&&!results[0][1]&&results[1][0]&&!results[1][1]){
			closures.push_back(closure(lst,lst,true,true));
			closures.push_back(closure(rst,rst,false,false));
		}else if(!results[0][0]&&results[0][1]&&!results[1][0]&&!results[1][1]){
			closures.push_back(closure(lst,lst,false,false));
			closures.push_back(closure(rst,rst,true,true));
		}else if(results[0][0]&&!results[0][1]&&!results[1][0]&&!results[1][1]){
			closures.push_back(closure(lst,lst,false,false));
			closures.push_back(closure(rst,rst,false,false));
		}else if(rst.empty()&&results[0][0]){
			closures.push_back(closure(lst,lst,false,false));
		}else if(rst.empty()&&results[1][0]){
			closures.push_back(closure(lst,lst,true,true));
		}else{
			closures.push_back(closure(lst,lst,true,true));
			closures.push_back(closure(lst,lst,false,false));
		}

	}
	vs names;
	REP(i,closures.size()){
		names.push_back(closures[i].l);
		names.push_back(closures[i].r);
	}
	sort(ALL(names));
	vs::iterator it=unique(ALL(names));
	names.resize(distance(names.begin(),it));
	V=names.size()*2;
	map<string,int> index;
	REP(i,names.size()){
		index[names[i]]=i;
	}
	REP(i,closures.size()){
		int li=(index[closures[i].l]+(closures[i].ls?0:V/2))%(V);
		int ri=(index[closures[i].r]+(closures[i].rs?0:V/2))%(V);
		add_edge((li+V/2)%(V),ri);
		if(li!=ri){
			add_edge((ri+V/2)%(V),li);
		}
	}
	scc();
	bool flag=true;
	REP(i,V/2){
		if(cmp[i]==cmp[V/2+i]){
			flag=false;
			break;
		}
	}
	cout<<(flag?"accept":"reject")<<endl;

}

Measured memory_bytes: 1496