# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

## Fancy Phone Numbers

A phone number is **Fancy** if any one of the following conditions is satisfied:

At least 4 consecutive digits in the given phone number are sequentially increasing. 908

**4567**091 and 9**01234**6709 are fancy but 98**4568**0210 is not.At least 3 consecutive digits in the given phone number are same. Example: 900

**111**8127.At least 2 consecutive digits in the given phone number are same, and this occurs in at least two non-overlapping places. For example: 198

**22**435**66**and 198**22**435**22**.if the frequency of any digit is at least 5. Example: 9897952399.

You are given some **valid** phone numbers, you need to find whether the given numbers are Fancy or not. A valid phone number is always 10 digits long and does not contain leading zeros.

#### Input

Input starts with an integer T (T ≤ 248832), denoting the number of test cases. Each case contains a valid phone number.

#### Output

For each test case, print **Fancy** if the phone number is Fancy, otherwise print Not Fancy. Please output the result of each test case on a separate line.

#### Samples

Input | Output |
---|---|

7 9084567091 9012346709 9845680210 9001118127 9897952399 1982243522 1982243566 | Fancy Fancy Not Fancy Fancy Fancy Fancy Fancy |

IOI_StfuFfs Earliest, 10M ago

Tarik.amtoly Fastest, 0.1s

IOI_StfuFfs Lightest, 2.2 MB

Tarik.amtoly Shortest, 785B

Login to submit