Lost Numbers

4.4

8 votes
Bit Manipulation, Basic Programming, Easy, Bit manipulation
Problem

Once Alice, Bob and Vasya got 2 numbers A and B. But it was a long time ago. At present, Alice remembers only the value a|b, while Bob remembers the value ab and Vasya remembers the value a&b.

You need to help them determine the values of A and B. If there are multiple answers print any one of them. If there are no valid A,B  then print 1.

Note

  • | is bitwise OR
  • & is bitwise AND
  •  is bitwise XOR

Input Format

  • The only line of input contains 3 integers representing the value of A|BAB and A&B respectively.

Output Format

  • If there exist any valid A,B, then print 2 integers A and B, otherwise print 1.

Constraints

  • All values in input [0,260)
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There are 2 samples.

Sample 1: Since, 14|11=151411=5 and 14&11=10A=14 and B=11 is a valid pair.

Sample 2: There does not exist any valid A,B, hence answer is 1

Editor Image

?