Problem: Ujan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers.

There are k boxes numbered from 1 to k. The i-th box contains n_i integer numbers. The integers can be negative. All of the integers are distinct.

Ujan is lazy, so he will do the following reordering of the numbers exactly once. He will pick a single integer from each of the boxes, k integers in total. Then he will insert the chosen numbers — one integer in each of the boxes, so that the number of integers in each box is the same as in the beginning. Note that he may also insert an integer he picked from a box back into the same box.

Ujan will be happy if the sum of the integers in each box is the same. Can he achieve this and make the boxes perfectly balanced, like all things should be?

Input

The first line contains a single integer k (1 ≤ k ≤ 15), the number of boxes. 

The i-th of the next k lines first contains a single integer n_i (1 ≤ n_i ≤ 5 000), the number of integers in box i. Then the same line contains n_i integers a_{i,1}, …, a_{i,n_i} (|a_{i,j}| ≤ 10^9), the integers in the i-th box. 

It is guaranteed that all a_{i,j} are distinct.

Output

If Ujan cannot achieve his goal, output "No" in a single line. Otherwise in the first line output "Yes", and then output k lines. The i-th of these lines should contain two integers c_i and p_i. This means that Ujan should pick the integer c_i from the i-th box and place it in the p_i-th box afterwards.

If there are multiple solutions, output any of those.

You can print each letter in any case (upper or lower).

Examples

Input


4
3 1 7 4
2 3 2
2 8 5
1 10


Output


Yes
7 2
2 3
5 1
10 4


Input


2
2 3 -2
2 -1 5


Output


No


Input


2
2 -10 10
2 0 -20


Output


Yes
-10 2
-20 1

Note

In the first sample, Ujan can put the number 7 in the 2nd box, the number 2 in the 3rd box, the number 5 in the 1st box and keep the number 10 in the same 4th box. Then the boxes will contain numbers \{1,5,4\}, \{3, 7\}, \{8,2\} and \{10\}. The sum in each box then is equal to 10.

In the second sample, it is not possible to pick and redistribute the numbers in the required way.

In the third sample, one can swap the numbers -20 and -10, making the sum in each box equal to -10.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("no-stack-protector")
using namespace std;
const long long MAX_N = 1200001;
const long long INF = 1e18;
long long a, b, c, d, e, x, t, tend, pos;
double elem;
double best_ans, ans_now;
long long pred[1000001];
vector<long long> vec[15];
long long sum[15];
vector<long long> rebra[100001];
bool re[10001][10001];
map<pair<long long, long long>, long long> map1;
string s, s2;
set<pair<long long, long long>> set1;
long long used[100001];
long long fib[200000], p = 1000000007;
unordered_map<long long, long long> num;
map<vector<pair<long long, long long>>, long long> co;
vector<vector<pair<long long, long long>>> vec2;
pair<bool, vector<pair<pair<long long, long long>, long long>>> ans[100000];
long long st[16];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  srand(time(0));
  st[0] = 1;
  for (long long i = 1; i < 16; i++) {
    st[i] = st[i - 1] * 2;
  }
  vector<pair<pair<long long, long long>, long long>> clak;
  clak.clear();
  for (long long i = 0; i < st[15]; i++) {
    ans[i] = {0, clak};
  }
  cin >> a;
  for (long long i = 0; i < a; i++) {
    cin >> b;
    for (long long j = 0; j < b; j++) {
      cin >> c;
      d += c;
      vec[i].push_back(c);
      num[c] = i + 1;
      sum[i] += c;
    }
  }
  if (d % a != 0) {
    cout << "No" << '\n';
    return 0;
  }
  d /= a;
  for (long long i = 0; i < a; i++) {
    if (sum[i] == d) {
      vector<pair<pair<long long, long long>, long long>> clak = {
          {{i, i}, vec[i][0]}};
      ans[st[i]] = {1, clak};
    }
    for (auto j : vec[i]) {
      for (long long i2 = 0; i2 < a; i2++) {
        long long sum2[15];
        for (long long i3 = 0; i3 < a; i3++) {
          sum2[i3] = sum[i3];
        }
        sum2[i] -= j;
        sum2[i2] += j;
        e = i;
        if (i == i2) {
          continue;
        }
        vector<long long> stek;
        stek.clear();
        vector<pair<pair<long long, long long>, long long>> clak;
        clak.clear();
        clak.push_back({{i, i2}, j});
        stek.push_back(e);
        long long bad[15];
        for (long long i = 0; i < 15; i++) {
          bad[i] = 0;
        }
        bad[i2] = 1;
        while (bad[e] == 0) {
          bad[e] = 1;
          long long f = d - sum2[e];
          if (num[f] == 0) {
            break;
          } else {
            sum2[e] = d;
            sum2[num[f] - 1] -= f;
            clak.push_back({{num[f] - 1, e}, f});
            e = num[f] - 1;
          }
          stek.push_back(e);
        }
        long long check = 0;
        for (auto i3 : stek) {
          if (sum2[i3] != d) {
            check = 1;
            break;
          }
        }
        if (check == 0) {
          long long f = 0;
          for (auto i3 : stek) {
            f += st[i3];
          }
          ans[f] = {1, clak};
        }
      }
    }
  }
  clak.clear();
  ans[0] = {1, clak};
  for (long long i = 1; i < st[a]; i++) {
    for (long long j = i; j; j = (j - 1) & i) {
      if (ans[j].first == 1 && ans[j ^ i].first == 1) {
        ans[i].first = 1;
        clak = ans[j].second;
        for (auto i2 : ans[j ^ i].second) {
          clak.push_back(i2);
        }
        ans[i].second = clak;
        break;
      }
    }
  }
  if (ans[st[a] - 1].first == 0) {
    cout << "No" << '\n';
    return 0;
  }
  cout << "Yes" << '\n';
  sort(ans[st[a] - 1].second.begin(), ans[st[a] - 1].second.end());
  for (auto i : ans[st[a] - 1].second) {
    cout << i.second << " " << i.first.second + 1 << '\n';
  }
  cin >> a;
  return 0;
}