#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;

const int MAX_V = 1002;

int n, m, V, cmp[MAX_V];
vector<int> G[MAX_V], rG[MAX_V], vs;
bool used[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;
}

bool t_list[MAX_V];
void judge(int v = m - 1) {
	t_list[v] = true;
	for(int i = 0; i < G[v].size(); ++i)
		if(!t_list[G[v][i]])
			judge(G[v][i]);
}

bool accept() {
	scc();
	for(int i = 0; i < m; ++i)
		if(cmp[i] == cmp[i + m])
			return false;

	judge();
	for(int i = 0; i < m; ++i)
		if(t_list[i] && t_list[i + m])
			return false;

	return true;
}

map<string, int> convert_table;
int convert(const string& s) {
	if(convert_table.count(s))
		return convert_table[s];

	else {
		convert_table.insert(make_pair(s, convert_table.size()));
		return convert_table.size() - 1;
	}
}

void OR(int l, int r) {
	add_edge((l + m) % V, r);
	add_edge((r + m) % V, l);
}

void binary_operator(const string& s, int part, bool is_and) {
	int cnt = 0, l;
	bool l_not = false, total_not = false;
	for(int i = part - 1; i >= 0; --i) {
		if(s[i] == ')')
			++cnt;

		else if(s[i] == '(')
			--cnt;

		else if(s[i] == '~')
			if(cnt >= 0)
				l_not = !l_not;
			else
				total_not = !total_not;

		else {
			int j = i;
			while(i > 0 && isalpha(s[i - 1])) --i;
			l = convert(s.substr(i, j - i + 1));
		}
	}

	int r;
	bool r_not = false;
	for(int i = part + 1; i < s.size(); ++i) {
		if(s[i] == '~')
			r_not = !r_not;

		else if(isalpha(s[i])) {
			int j = i;
			while(i + 1< s.size() && isalpha(s[i + 1])) ++i;
			r = convert(s.substr(j, i - j + 1));
		}
	}

	if(total_not) {
		l_not = !l_not;
		r_not = !r_not;
		is_and = !is_and;
	}

	if(l_not) l += m;
	if(r_not) r += m;

	if(is_and) {
		OR(l, V - 1);
		OR(r, V - 1);
	}
	else
		OR(l, r);
}

void parse(const string& s) {
	int part;
	for(int i = 0; i < s.size(); ++i) {
		if(s[i] == '|' || s[i] == '&') {
			part = i;
			binary_operator(s, part, (s[i] == '&'));
			return;
		}
	}

	int var;
	bool is_not = false;
	for(int i = 0; i < s.size(); ++i) {
		if(isalpha(s[i])) {
			int j = i;
			while(i + 1< s.size() && isalpha(s[i + 1])) ++i;
			var = convert(s.substr(j, i - j + 1));
			break;
		}
		else if(s[i] == '~')
			is_not = !is_not;
	}

	if(is_not)
		var += m;

	OR(var, V - 1);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n >> m;
	V = 2 * ++m;

	for(int i = 0; i < n; ++i) {
		string cond;
		cin >> cond;

		cond = cond.substr(0, cond.size() - 1);

		parse(cond);
	}

	cout << (accept() ? "accept" : "reject") << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1372