あなたは、パイプのシステムを与えられています。それは、2つの列で構成され、各行は、から成り 、N、Nパイプ。左上パイプ座標有する (1 、1 ) - (1,1)と右下の (2 、N )(2、n)を。
直管の二つのタイプと湾曲管4種類:パイプの6種類があります。ここでは、すべての6つのタイプの例は以下のとおりです。
あなたは、与えられたパイプのそれぞれを回すことができる 90 90度時計方向または反時計方向 の任意の(おそらくゼロ)回数(SOタイプ 1 1、 2 2が互いにタイプになることができ 3 、4 、5 、6 3,4,5 、6)が互いになることができます。
あなたは、水の流れがで始めることができるような方法で、いくつかのパイプを有効にする (1 、0 )、(左上パイプの左側)(1,0)でパイプに移動する (1 、1 )、(1 1)によって何とか流れ で管に接続パイプ (2 、N )(2、n)と右に流れ (2 、N + 1 )(2、N + 1)。
彼らは、システム内の隣接しており、その端部が接続されている場合はパイプが接続されています。ここでは、接続パイプの例は以下のとおりです。
のは、いくつかの例を使用して問題を説明してみましょう:
そして、その解決策は以下の通りです:
As you can see, the water flow is the poorly drawn blue line. To obtain the answer, we need to turn the pipe at (1,2)(1,2) 9090 degrees clockwise, the pipe at (2,3)(2,3) 9090 degrees, the pipe at (1,6)(1,6) 9090 degrees, the pipe at (1,7)(1,7) 180180 degrees and the pipe at (2,7)(2,7) 180180degrees. Then the flow of water can reach (2,n+1)(2,n+1) from (1,0)(1,0).
You have to answer qq independent queries.
The first line of the input contains one integer qq (1≤q≤1041≤q≤104) — the number of queries. Then qq queries follow.
Each query consists of exactly three lines. The first line of the query contains one integer nn (1≤n≤2⋅1051≤n≤2⋅105) — the number of pipes in each row. The next two lines contain a description of the first and the second rows correspondingly. Each row description consists of nndigits from 11 to 66 without any whitespaces between them, each digit corresponds to the type of pipe in the corresponding cell. See the problem statement to understand which digits correspond to which types of pipes.
It is guaranteed that the sum of nn over all queries does not exceed 2⋅1052⋅105.
For the ii-th query print the answer for it — "YES" (without quotes) if it is possible to turn some pipes in a way that the water flow can reach (2,n+1)(2,n+1) from (1,0)(1,0), and "NO" otherwise.