Hide

Problem F
Órökrétt

Languages en is

Anna is a renowned logician. Recently she has been looking into boolean expressions of different forms. Two common ones are ANF (and normal form) and ONF (or normal form).

In ANF the expression is composed of one or more clauses with ANDs between, where each clause consists of one or more variables (or the negation of a variable) with ORs in between. An example of a boolean expression of ANF normal form is:

(a OR !b) AND (c) AND (!a OR !c OR b)

ONF is similar, but then it’s composed of one or more clauses with ORs in between, where each clause consists of one or more variables (or their negation) with ANDs in between. An example of a boolean expression of ONF normal form is:

(c) OR (b AND !a) OR (!b AND a AND !c)

A common problem for a logician is to check whether a boolean expression can be made true by setting the variables as TRUE or FALSE. If it is possible the boolean expression is said to be satisfiable. For example the following expression can be made true by setting a = FALSE, b = FALSE, c = TRUE and it is thus satisfiable:

(a OR !b) AND (c) AND (!a OR !c OR b)

On the other hand the following boolean expression can not be made true no matter what values the variables get, and is thus unsatisfiable:

(a OR b) AND (!a OR !b)

Anna made a brilliant discovery. She found an efficient way to change a boolean expression of ANF normal form to an equivalent one of ONF normal form. Now she asks you to help her check if the boolean expression of ONF normal form is satisfiable.

Input

One line containing a boolean expression of ONF normal form. Each variable only contains English lower case letters and has length 1 to 5.

Output

One line containing Jebb if the boolean expression is satisfiable and Neibb otherwise.

Scoring

The solution will be tested on input data of varying difficulty and the data is divided into groups as shown in the table below. The solution will then be scored according to how many groups are solved.

Group

Points

Constraints

1

50

There are at most $10$ variables, denoted by a single letter from a to j and there are at most $10$ clauses

2

50

There are up to $1000$ variables and up to $100$ clauses.

Sample Input 1 Sample Output 1
(a OG c) EDA (!b OG !c)
Jebb
Sample Input 2 Sample Output 2
(a OG b OG !c OG !a) EDA (!b OG !a OG b)
Neibb

Please log in to submit a solution to this problem

Log in