Valid Binary String

No attempts yetTime limit1sMemory limit128 MB

Problem

A string made up only of the characters 0 and 1 is called a binary string. A binary string is called a valid binary string if it satisfies both of the following conditions:

  1. Balanced: the number of 0s equals the number of 1s.
  2. Run limit: the same character never appears three or more times in a row; that is, every maximal run of consecutive 0s or consecutive 1s has length at most 2.

You are given a binary string in which some characters have been erased. Write a program that decides whether the erased positions can each be filled with a 0 or a 1 so that the whole string becomes a valid binary string.

Input

The first line contains the number of test cases $T$ ($T \le 100$).

Each test case is given on its own line as a string made up of the characters 0, 1, and ., where . marks an erased position. The length of the string is an even number between 2 and 100,000, inclusive.

Output

For each test case, print yes if the given string can be turned into a valid binary string, and no otherwise, each on its own line.