Under construction

Still being built. Things may change

Magic Mushrooms

Interview

Time limit2sMemory limit1024 MB

Summary
For each of N numbers, print Yes if it is a Fibonacci number (1, 1, 2, 3, 5, ...) and No otherwise.
Level

Medium5 of 10

Topics
Math, Number theory
Solved
No attempts yet

Problem

On the planet Ruuk there is the Big Corporation of Little Fairies. Its fairies have long planted beds of magic mushrooms. From the first day the corporation existed, the fairies create one new bed every day. For two days after a new bed is made, its spores can be collected. After that, the bed produces only the mushrooms themselves.

If cic_i is the number of mushrooms planted on the bed created on day ii, then ci=ci−1+ci−2c_i = c_{i-1} + c_{i-2}. The first and second days each had one mushroom, the third had two, the fourth had three, the fifth had five, and so on.

Magic mushrooms are the most valuable souvenirs a traveler can bring from Ruuk, so every visitor first looks for a magic mushroom bed. Lately, however, reports of fake magic mushrooms have become more frequent. A careful investigation showed that the Small Corporation of Big Fairies is behind them. It plants beds that look identical but are far less valuable. When it creates a bed, it plants a number of mushrooms that its rivals have never planted and will never be able to plant.

Write a program that, given the number of mushrooms on a bed, determines whether that bed is magic.

Input

The first line contains one integer NN (1≤N≤1,000,0001 \le N \le 1,000,000), the number of beds to check. Each of the next NN lines contains one integer aia_i, the number of mushrooms on a bed being checked. The input file is at most 1 MB.

Output

For each number in the input, print Yes if a bed with that many mushrooms is magic, and No otherwise. Print each answer on its own line.

Examples1

  1. Example 1

    Input
    8
    1
    2
    3
    4
    5
    6
    7
    8
    
    Expected output
    Yes
    Yes
    Yes
    No
    Yes
    No
    No
    Yes