#include <bits/stdc++.h>
using namespace std;
const int mxn = 256, k = 3;
int n;
int a[mxn], b[mxn], d[mxn], first[1 << k];
vector<pair<int, int> > e;
vector<int> v[1 << k];
queue<int> q;
queue<pair<int, int> > qq;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      a[i] |= x << j;
    }
    v[a[i]].push_back(i);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      b[i] |= x << j;
    }
  memset(first, -1, sizeof(first));
  first[7] = 0;
  q.push(7);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i : v[x])
      if (i != first[x]) {
        int y = a[i] & b[i];
        e.push_back({first[x], i});
        if (!~first[y]) {
          d[i] = 1, first[y] = i;
          q.push(y);
        }
      }
  }
  for (int i = 0; i < k; i++)
    if (~first[1 << i])
      for (int j = 0; j < i; j++)
        if (~first[1 << j]) {
          int x = (1 << i) | (1 << j);
          if (!~first[x] && !v[x].empty()) {
            first[x] = v[x][0];
            e.push_back({first[1 << i], first[x]});
            e.push_back({first[1 << j], first[x]});
            for (int l : v[x])
              if (l != first[x]) {
                e.push_back({first[x], l});
              }
          }
        }
  bool t = 1;
  for (int i = 1; i < (1 << k); i++) t &= ~first[i] || v[i].empty();
  if (t) {
    cout << "Possible" << '\n';
    cout << d[0];
    for (int i = 1; i < n; i++) cout << " " << d[i];
    cout << '\n';
    cout << e.size() << '\n';
    for (pair<int, int> i : e)
      cout << (i.first + 1) << " " << (i.second + 1) << '\n';
  } else {
    cout << "Impossible" << '\n';
  }
  return 0;
}
