#include <bits/stdc++.h>   using namespace std;   int vis[10], A[300], B[300];   int ct[300], mrk[300];   vector<pair<int, int>> ans;   int main() {     int n, x;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       for (int j = 0; j < 3; j++) {         scanf( %d , &x);         A[i] |= (1 << j) * x;       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < 3; j++) {         scanf( %d , &x);         B[i] |= (1 << j) * x;       }     }     vis[7] = ct[0] = vis[0] = mrk[0] = 1;     for (int i = 1; i <= 7; i++) {       for (int j = 1; j <= 7; j++) {         for (int k = 0; !vis[j] && k < n; k++) {           if (vis[A[k]] && (A[k] & B[k]) == j) {             vis[j] = k + 1;             ct[k] = mrk[k] = 1;             ans.push_back({vis[A[k]], k + 1});           }           for (int _k = (A[k] - 1) & A[k]; _k != 0 && !vis[j];                _k = (_k - 1) & A[k]) {             if (vis[A[k] ^ _k] && vis[_k] && (B[k] & A[k]) == j) {               vis[j] = k + 1;               ct[k] = mrk[k] = 1;               ans.push_back({vis[_k], k + 1});               ans.push_back({vis[A[k] ^ _k], k + 1});             }             if (!vis[j] && vis[A[k] ^ _k] && vis[_k] && A[k] == j) {               vis[j] = k + 1;               mrk[k] = 1;               ans.push_back({vis[_k], k + 1});               ans.push_back({vis[A[k] ^ _k], k + 1});             }           }         }       }     }     for (int i = 0; i < n; i++) {       if (!vis[A[i]]) return !printf( Impossible n );       if (!mrk[i] && A[i] != 0) ans.push_back({vis[A[i]], i + 1});     }     printf( Possible n );     for (int i = 0; i < n; i++) printf( %d  , ct[i]);     printf(  n%d n , (int)ans.size());     for (auto it : ans) printf( %d %d n , it.first, it.second);     return 0;   }   