Jane is a very popular magician. But to perform a magic he needs the magical numbers. The magical numbers are the positive integers whose decimal representations contain the magical digits 1 and 2. For example, numbers 11, 2 are magical numbers and 7, 36 are not. But all numbers containing 1 and 2 are not magical. Jane calls a number, magical number, if the count of magical digits in it contains the magical digits only. Help Jane to find the magical number.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains 1 line contains an integer n.

**Output:**

Print on the new line "YES" if n is a magical number. Otherwise, print "NO".

**Constraints:**

1<=T<=100

1<=n<=10^{18}

**Example:**

**Input:**

4

12003

46003

31374

300000000

**Output:**

YES

NO

YES

NO

**Explanation:**

In the first example there are 2 magic digits, 2 is magic number, so the answer is "YES".

In the second example there is no magic digit, so the answer is "NO".

Author: arun03

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

SashaV | 220 |

VivSisMMM | 216 |

GustavoMéndez | 210 |

GHJKL | 196 |

d_Coder00 | 189 |

Pulkit__Sharma__ | 742 |

Anirban166 | 677 |

Found_me | 598 |

abducodes | 590 |

Sathvik Avasarala | 518 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4559 |

Login to report an issue on this page.