import java.util.Scanner;
public class c461 {
public static void main(String[]args) {
Scanner s=new Scanner(System.in);
String o;
long a,b,c;
while(s.hasNext()){
o=s.next();
a=s.nextLong();
b=s.nextLong();
c=s.nextLong();
System.out.println(o);
if (a == 0 && b == 0 ) {
if(c==0) {
System.out.println("AND");
System.out.println("OR");
System.out.println("XOR");
}else if(c!=0) {
System.out.println("IMPOSSIBLE");
}
}
else if (a == 0 && b != 0 || a != 0 && b == 0 ) {
if(c==0) {
System.out.println("AND");
}else if(c!=0) {
System.out.println("OR");
System.out.println("XOR");
}
}
else if (a != 0 && b != 0 ) {
if(c!=0) {
System.out.println("AND");
System.out.println("OR");
}else if(c==0) {
System.out.println("XOR");
}
}
}
}
}