#include <bits/stdc++.h>
using namespace std;
const long long maxn = 5e3 + 10;
const long long INF = 0x7f7f7f7f7f;
long long n;
long long cnt[16];
long long tot[16];
long long a[16][maxn];
unordered_map<long long, long long> mp, mp2;
pair<long long, long long> ans[16];
vector<pair<long long, long long> > dp[1 << 16];
int main() {
  long long n;
  long long sum = 0;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &cnt[i]);
    for (long long j = 1; j <= cnt[i]; j++) {
      scanf("%lld", &a[i][j]);
      tot[i] += a[i][j];
      mp[a[i][j]] = i;
    }
    sum += tot[i];
  }
  if (sum % n) {
    puts("NO");
    return 0;
  }
  sum /= n;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= cnt[i]; j++) {
      mp2[a[i][j]] = sum - tot[i] + a[i][j];
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= cnt[i]; j++) {
      vector<pair<long long, long long> > vec;
      long long s = 1 << (i - 1);
      long long x = mp2[a[i][j]];
      vec.push_back(make_pair(i, x));
      while (mp.count(x) && !(s & (1 << (mp[x] - 1)))) {
        s |= (1 << (mp[x] - 1));
        vec.push_back(make_pair(mp[x], mp2[x]));
        x = mp2[x];
      }
      if (x == a[i][j] && !dp[s].size()) dp[s] = vec;
    }
  }
  for (long long i = 0; i < (1 << n); i++) {
    if (dp[i].size()) continue;
    for (long long j = i; j; j = i & (j - 1)) {
      if (dp[j ^ i].size() && dp[j].size()) {
        for (long long k = 0; k < dp[j].size(); k++) {
          dp[i].push_back(dp[j][k]);
        }
        for (long long k = 0; k < dp[i ^ j].size(); k++) {
          dp[i].push_back(dp[i ^ j][k]);
        }
        break;
      }
    }
  }
  if (!dp[(1 << n) - 1].size()) {
    puts("NO");
    return 0;
  }
  puts("YES");
  for (long long i = 0; i < dp[(1 << n) - 1].size(); i++) {
    ans[mp[dp[(1 << n) - 1][i].second]] =
        make_pair(dp[(1 << n) - 1][i].second, dp[(1 << n) - 1][i].first);
  }
  for (long long i = 1; i <= n; i++) {
    printf("%lld %lld\n", ans[i].first, ans[i].second);
  }
}
