410188: GYM103969 H Janky Jaffa Cakes

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Janky Jaffa Cakestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Inspired by https://www.youtube.com/watch?v=yEmgU9oX7ns

Tom is very fond of Jaffa Cakes, but he is having trouble convincing Zendaya to eat his favorite dessert. Because Tom knows that Zendaya is a fan of number games, he decides to play a game with her involving the serial numbers on each of the $$$N$$$ Jaffa Cakes he possesses. The $$$i$$$-th Jaffa Cake initially has serial number $$$x_i$$$, and Zendaya can choose to repeatedly modify the serial numbers via a special operation. Each operation involves choosing an index $$$j$$$ such that $$$1 \leq j \leq N$$$ and a positive integer $$$y$$$, and every Jaffa Cake except for the $$$j$$$-th one will have its serial number changed to $$$x_i \oplus y$$$ (in other words, $$$x_i$$$ is XORed with $$$y$$$ for all $$$i \neq j$$$).

If Zendaya can successfully transform all $$$N$$$ serial numbers to $$$0$$$ using the operation, she does not have to eat a Jaffa Cake. Otherwise, she must humor Tom's request and eat the dessert. Given the serial numbers on the Jaffa Cakes, can you help Zendaya figure out if she has a chance to avoid a tasting?

Input

The first line of input contains a single integer $$$N$$$ ($$$1 \leq N \leq 100$$$) representing the number of Jaffa Cakes that Tom has for the game. The second line of input contains $$$N$$$ space separated integers $$$x_i$$$ ($$$0 \leq x_i < 2^{30}$$$) that represent the original serial numbers of the Jaffa Cakes.

Output

If Zendaya (assuming she plays optimally) has to eat a Jaffa Cake after playing the game, print "JAFFA!" on a single line. Otherwise, output "NO JAFFA!" on a single line.

ExamplesInput
4
1 2 3 4
Output
NO JAFFA!
Input
3
1 1 1
Output
JAFFA!

加入题单

上一题 下一题 算法标签: