#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <bitset>
   
using namespace std;
   
 
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define rforeach(it, c) for (__typeof__((c).rbegin()) it=(c).rbegin(); it != (c).rend(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CL(arr, val) memset(arr, val, sizeof(arr))
#define COPY(dest, src) memcpy(dest, src, sizeof(dest))
#define ten(n) ((long long)(1e##n))
#define bin(n) (1ull << (n))
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define revrep(i, n) for (int i = (n); i >= 0; --i)
#define pb push_back

template <class T> void chmax(T& a, const T& b) { a = max(a, b); }
template <class T> void chmin(T& a, const T& b) { a = min(a, b); }

template <class T> void uniq(T& c) { sort(c.begin(), c.end()); c.erase(unique(c.begin(), c.end()), c.end()); }
 
template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
  
template <class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { os << "( " << p.first << ", " << p.second << " )"; return os; }
  
template <class T> void print(T a, int n, const string& deli = " ", int br = 1) { for (int i = 0; i < n; ++i) { cout << a[i]; if (i + 1 != n) cout << deli; } while (br--) cout << endl; }
template <class T> void print(const T& c, const string& deli = " ", int br = 1) { foreach (it, c) { cout << *it; if (++it != c.end()) cout << deli;--it; } while (br--) cout << endl; }
template <class T> void print2d(T a, int w, int h, int width = -1, int br = 1) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) {    if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
   
template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }

void fix_pre(int n) { cout.setf(ios::fixed, ios::floatfield); cout.precision(10); }
void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
#define trace(x) (cout << #x << ": " << (x) << endl)
 
bool in_rect(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }


typedef long long ll;
typedef pair<int, int> pint;
 
// y(v): v>^<  y(^): ^>v<
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };

const double PI = acos(-1.0);



class TwoSAT
{
private:
    class SCC_TwoSAT
    {
    public:
        int V;
        vector<vector<int> > g;
        vector<vector<int> > rg;
        vector<int> vs;	// 帰りの順番, 後ろのほう要素は始点側
        vector<bool> used;
        vector<int> component;

        SCC_TwoSAT(int V)
            : V(V), g(V), rg(V), vs(V), used(V), component(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;
            component[v] = k;
            for (int i = 0; i < rg[v].size(); ++i)
                if (!used[rg[v][i]])
                    rdfs(rg[v][i], k);
        }

        // 強連結成分の数を返す
        // O(V + E)
        // グラフの始点側の値(component[v])は小さい
        // 末端は大きい値, 最末端(component[v] == scc() - 1)
        int scc()
        {
            vs.clear();
            fill(used.begin(), used.end(), false);
            for (int i = 0; i < V; ++i)
                if (!used[i])
                    dfs(i);

            fill(used.begin(), used.end(), false);
            int k = 0;
            for (int i = vs.size() - 1; i >= 0; --i)
                if (!used[vs[i]])
                    rdfs(vs[i], k++);
            return k;
        }
    };
    
    SCC_TwoSAT scc;
public:
    int n;
    
    TwoSAT(int n)
        :  scc(2 * n), n(n) {}

    int NOT(int i) { return i < n ? i + n : i - n; }

    // raw method by adding edge directly
    // a -> b (~a or b)
    void add_edge(int a, int b)
    {
        scc.add_edge(a, b);
    }

    // a or b (~a -> b and ~b -> a)
    void add_or(int a, int b)
    {
        add_edge(NOT(a), b);
        add_edge(NOT(b), a);
    }

    // a and b
    void add_and(int a, int b)
    {
        assign(a, true);
        assign(b, true);
    }

    // do a = val
    void assign(int a, bool val)
    {
        if (!val)
            a = NOT(a); // a = false to ~a = true
        add_edge(NOT(a), a); // a, a or a, ~a -> a
    }

    bool satisfy()
    {
        scc.scc();
        for (int i = 0; i < n; ++i)
            if (scc.component[i] == scc.component[NOT(i)])
                return false;
        return true;
    }

    bool val(int i)
    {
        return scc.component[i] > scc.component[NOT(i)];
    }
};

TwoSAT sat(0);
map<string, int> id;

const int OR = 0, AND = 1, UNARY = -1;
struct Res
{
    int left, right, op;
    Res() : op(UNARY) {}
    Res to_not() const
    {
        Res res;
        res.left = sat.NOT(left);
        res.right = sat.NOT(right);
        res.op = op == UNARY ? op : (op ^ 1);
        return res;
    }
};

string s;
int p;
Res expr();
Res factor();
Res expr()
{
    Res res = factor();
    while (s[p] == '&' || s[p] == '|')
    {
        res.op = s[p] == '|' ? OR : AND;
        ++p;
        res.right = factor().left;
    }
    return res;
}

Res var()
{
    string name;
    while (isalpha(s[p]))
        name += s[p++];

    if (!id.count(name))
    {
        int s = id.size();
        id[name] = s;
    }
    Res res;
    res.left = id[name];
    return res;
}
Res factor()
{
    if (s[p] == '~')
    {
        ++p;
        return factor().to_not();
    }
    else if (s[p] == '(')
    {
        ++p;
        Res res = expr();
        ++p;
        return res;
    }
    else if (isalpha(s[p]))
        return var();
    else
        assert(false);
}


Res parse(string s)
{
    ::s = s;
    p = 0;
    return expr();
}

int main()
{
    int n, m;
    cin >> n >> m;

    sat = TwoSAT(m);
    rep(i, n)
    {
        string s;
        cin >> s;
        Res c = parse(s);

        if (c.op == UNARY)
            sat.assign(c.left, true);
        else if (c.op == OR)
            sat.add_or(c.left, c.right);
        else if (c.op == AND)
            sat.add_and(c.left, c.right);
        else
            assert(false);
    }
    cout << (sat.satisfy() ? "accept" : "reject") << endl;
}

Measured memory_bytes: 1348