#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

using ll = long long;
using P = std::tuple<int,int>;
using Q = std::tuple<int,int,int>;

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

template <int capacity, int _>
struct SCC{
    bool used[capacity];
    int indices[capacity], g_indices[capacity];

    void calc(int V, const std::vector<int> (&graph)[_], const std::vector<int> (&rev_graph)[_]){
        int n = 0;
    
        memset(used, 0, sizeof(used));
        for(int i=0;i<V;++i){
            if(!used[i]){dfs(i, n, graph);}
        }

        n = 0;

        memset(used, 0, sizeof(used));
    
        for(int i=V-1;i>=0;--i){
            if(!used[indices[i]]){
                rdfs(indices[i], n++, rev_graph);
            }
        }
    }
    
    void dfs(int v, int &n, const std::vector<int> (&graph)[_]){
        used[v] = true;
    
        for(int i : graph[v]){
            if(!used[i]){
                dfs(i, n, graph);
            }
        }

        indices[n++] = v;
    }

    void rdfs(int v, int n, const std::vector<int> (&rev_graph)[_]){
        used[v] = true;
        g_indices[v] = n;

        for(int i : rev_graph[v]){
            if(!used[i]){
                rdfs(i, n, rev_graph);
            }
        }
    }
};

// i: a[i], i+M: ~a[i]
int N, M;
std::vector<int> G[2000], rG[2000];
SCC<3000, 2000> scc;
int var_n;
map<std::string, int> cor;

enum class Tag {And, Or, Var};
using Formula = tuple<Tag, int, int>;

Formula andOr(string::const_iterator& head);
Formula neg(string::const_iterator& head);
Formula factor(string::const_iterator& head);

Formula andOr(string::const_iterator& head){
    Formula f1 = neg(head);
    if(*head == '&'){
        ++head;
        Formula f2 = neg(head);
        return std::make_tuple(Tag::And, snd(f1), snd(f2));
    }else if(*head == '|'){
        ++head;
        Formula f2 = neg(head);
        return std::make_tuple(Tag::Or, snd(f1), snd(f2));
    }
    
    return f1;
}

Formula neg(string::const_iterator& head){
    int neg_n = 0;
    while(*head == '~'){
        ++head;
        ++neg_n;
    }
    
    Formula f = factor(head);

    if(neg_n % 2 == 1){
        Tag t = fst(f);
        if(t == Tag::And){
            fst(f) = Tag::Or;
        }else if(t == Tag::Or){
            fst(f) = Tag::And;
        }
        
        snd(f) = (snd(f) + M) % (2 * M);
        thd(f) = (thd(f) + M) % (2 * M);
    }
    
    return f;
}

Formula factor(string::const_iterator& head){
    if(*head == '('){
        ++head;
        Formula f = andOr(head);
        ++head;
        return f;
    }

    std::string var = "";
    while(isalpha(*head)){
        var += *head;
        ++head;
    }

    if(cor.find(var) == cor.end()){
        cor[var] = var_n++;
    }

    return std::make_tuple(Tag::Var, cor[var], -1);
}

void makeEdge(int u, int v){
    G[u].emplace_back(v);
    rG[v].emplace_back(u);
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    std::cin >> N >> M;

    for(int i=0;i<N;++i){
        std::string S;
        std::cin >> S;

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

        string::const_iterator it = S.begin();
        Formula x = andOr(it);

        if(fst(x) == Tag::Var){
            makeEdge((snd(x) + M) % (2 * M), snd(x));
        }else if(fst(x) == Tag::And){
            makeEdge((snd(x) + M) % (2 * M), snd(x));
            makeEdge((thd(x) + M) % (2 * M), thd(x));
        }else{
            makeEdge((thd(x) + M) % (2 * M), snd(x));
            makeEdge((snd(x) + M) % (2 * M), thd(x));
        }
    }

    scc.calc(2 * M, G, rG);

    for(int i=0;i<M;++i){
        if(scc.g_indices[i] == scc.g_indices[i+M]){
            std::cout << "reject" << std::endl;
            return 0;
        }
    }

    std::cout << "accept" << std::endl;
}

Measured memory_bytes: 3412