Alice is playing cards with the Queen of Hearts, King of Hearts, and Jack of Hearts. There are 𝑛 different types of cards in their card game. Alice currently has a card of type 1 and needs a card of type 𝑛 to escape Wonderland. The other players have one of each kind of card.

In this card game, Alice can trade cards with the three other players. Each player has different preferences for the 𝑛 types of cards, which can be described by permutations∗ 𝑞, 𝑘, and 𝑗 for the Queen, King, and Jack, respectively.

A player values card 𝑎 more than card 𝑏 if for their permutation 𝑝, 𝑝𝑎>𝑝𝑏. Then, this player is willing to trade card 𝑏 to Alice in exchange for card 𝑎. Alice's preferences are straightforward: she values card 𝑎 more than card 𝑏 if 𝑎>𝑏, and she will also only trade according to these preferences.

Determine if Alice can trade up from card 1 to card 𝑛 subject to these preferences, and if it is possible, give a possible set of trades to do it.

∗A permutation of length 𝑛 is an array consisting of 𝑛 distinct integers from 1 to 𝑛 in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the array), and [1,3,4] is also not a permutation (𝑛=3 but there is 4 in the array).
Input
Each test contains multiple test cases. The first line contains the number of test cases 𝑡 (1≤𝑡≤104). The description of the test cases follows.

The first line of each test case contains an integer 𝑛 (2≤𝑛≤2⋅105) — the number of card types.

The next three lines contain the preferences of the Queen, King, and Jack respectively. Each of these lines contains 𝑛 integers 𝑝1,𝑝2,…,𝑝𝑛 (1≤𝑝𝑖≤𝑛) — a permutation corresponding to the player's preferences.

The sum of 𝑛 over all test cases does not exceed 2⋅105.

Output
For each test case, on the first line output a single string "YES" or "NO" (without the quotes) denoting whether Alice can trade up to card 𝑛.

If the first line was "YES", then on the next line output 𝑘 — the number of trades Alice will make. On the next 𝑘 lines output space separated a character 𝑐∈{𝚚,𝚔,𝚓} and integer 𝑥, denoting that Alice trades with player 𝑐 to get card 𝑥. It must be the case that on the 𝑘'th line, 𝑥=𝑛. If there are multiple solutions, print any of them.

You can output this answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses. The same goes for the character 𝑐 denoting the player in the trade (𝚀,𝙺,𝙹 will all be accepted alongside their lowercase variants).

Example
inputCopy
2
3
1 3 2
2 1 3
1 2 3
4
2 3 1 4
1 2 3 4
1 4 2 3
outputCopy
YES
2
k 2
q 3
NO
Note
In the first testcase, Alice can trade with the King to get card 2. She can then trade with the Queen to get card 3.

In the second testcase, even though Alice can trade with the Queen to get card 3, with the King to get card 2, and then with the Jack to get card 4, this is not a valid solution since it doesn't respect Alice's preferences. We can show that there is no way for Alice to get to card 4. Please use #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
#define endl '\n'

void solve() {
  int n; cin >> n;
  vector<vector<int>> a(3, vector<int>(3));
  for(int i = 0; i < 3; ++i){
    for(int j = 0; j < 3; ++j){
      cin >> a[i][j];
    }
  }

}

int main(){
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int t; cin >> t;
  while(t--) solve();
}