#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> mask(n, 0), filter(n, 0);
  for (int i = 0; i < n; i += 1) {
    for (int j = 0; j < 3; j += 1) {
      int x;
      cin >> x;
      mask[i] |= x * (1 << j);
    }
  }
  for (int i = 0; i < n; i += 1) {
    for (int j = 0; j < 3; j += 1) {
      int x;
      cin >> x;
      filter[i] |= x * (1 << j);
    }
  }
  auto tryOrder =
      [&](vector<int> p) -> pair<vector<int>, vector<pair<int, int>>> {
    vector<int> have(8, -1);
    vector<int> ct(n, 0);
    vector<pair<int, int>> cd;
    for (int i = 0; i < n; i += 1) {
      if (p[i] == 0) {
        have[7] = 0;
        continue;
      }
      if (mask[p[i]] == 0) continue;
      if (have[mask[p[i]]] >= 0) {
        cd.push_back(make_pair(have[mask[p[i]]], p[i]));
        have[mask[p[i]] & filter[p[i]]] = p[i];
        ct[p[i]] = 1;
      } else {
        bool ok = false;
        for (int a = 0; a < 8 and not ok; a += 1)
          for (int b = 0; b < 8 and not ok; b += 1)
            if ((a | b) == mask[p[i]] and have[a] >= 0 and have[b] >= 0) {
              ok = true;
              cd.push_back(make_pair(have[a], p[i]));
              cd.push_back(make_pair(have[b], p[i]));
              have[mask[p[i]]] = p[i];
            }
        if (not ok) {
          return make_pair(vector<int>(), cd);
        }
      }
    }
    return make_pair(ct, cd);
  };
  vector<int> perm(n, 0);
  iota(perm.begin(), perm.end(), 0);
  vector<int> delicate = {3, 5, 6};
  vector<int> id = delicate;
  vector<int> order(8, 0);
  iota(order.begin(), order.end(), 0);
  do {
    for (int i = 0; i < 3; i += 1) {
      order[id[i]] = delicate[i];
    }
    sort(perm.begin(), perm.end(), [&](int a, int b) {
      if (mask[a] != mask[b]) return order[mask[a]] > order[mask[b]];
      return a < b;
    });
    auto sol = tryOrder(perm);
    if (not sol.first.empty()) {
      auto ct = sol.first;
      auto cd = sol.second;
      cout << "Possible\n";
      for (int i = 0; i < n; i += 1) cout << ct[i] << " ";
      cout << "\n";
      cout << cd.size() << "\n";
      for (auto edge : cd) {
        cout << edge.first + 1 << " " << edge.second + 1 << "\n";
      }
      return 0;
    }
  } while (next_permutation(delicate.begin(), delicate.end()));
  cout << "Impossible\n";
}
