#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> required(n, 0), filter(n, 0);
  for (int i = 0; i < n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    required[i] = 4 * a + 2 * b + c;
  }
  for (int i = 0; i < n; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    filter[i] = 4 * a + 2 * b + c;
  }
  vector<bool> marked(n, 0);
  vector<int> canonical(8, -1);
  vector<int> ct(n, -1);
  marked[0] = true;
  canonical[7] = 0;
  ct[0] = 1;
  vector<pair<int, int>> edges;
  while (true) {
    bool any_changes = false;
    for (int i = 0; i < n; ++i) {
      if (marked[i]) {
        continue;
      }
      vector<int> bits;
      for (int k = 0; k < 3; ++k) {
        if (required[i] & (1 << k)) {
          bits.push_back(1 << k);
        }
      }
      if (canonical[required[i]] != -1) {
        int j = canonical[required[i]];
        edges.push_back({j, i});
        marked[i] = true;
        any_changes = true;
        ct[i] = 1;
        canonical[required[i] & filter[i]] = i;
      } else if (bits.size() == 2 && canonical[bits[0]] != -1 &&
                 canonical[bits[1]] != -1) {
        edges.push_back({canonical[bits[0]], i});
        edges.push_back({canonical[bits[1]], i});
        marked[i] = true;
        any_changes = true;
        ct[i] = 0;
        canonical[required[i]] = i;
      }
    }
    if (!any_changes) {
      break;
    }
  }
  if (find(marked.begin(), marked.end(), false) != marked.end()) {
    cout << "Impossible\n";
    return;
  }
  cout << "Possible\n";
  for (int i = 0; i < n; ++i) {
    cout << ct[i] << " ";
  }
  cout << "\n";
  cout << edges.size() << "\n";
  for (auto& edge : edges) {
    cout << edge.first + 1 << " " << edge.second + 1 << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
