#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i=0;i<(long long)(n);i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    vector<pll> v;
    rep(i,6){
        rep(j,6){
            v.emplace_back(i,j);
        }
    }
    random_shuffle(all(v));
    rep(i,35){
        ll d;
        rep(i,6) cin >> d;
        cout << v[i].first+1 << " " << v[i].second+1 << endl;
    }
}