#include <iostream>
#include <cstdlib>
using namespace std;
typedef struct struktura{
    int a;
    int b;
}STR;

int main()
{
    int n,i;
    cin>>n;
    STR niz[n];
    STR miz[n];
    STR miz1[n];
    for(i=0;i<n;i++){
        cin>>niz[i].a;
        cin>>niz[i].b;
    }
    for(i=0;i<n;i++){
        cout<<niz[i].a;
        cout<<" ";
        cout<<niz[i].b;
        cout<<"\n";
    }
    for(i=0;i<n;i++){
        do{
        do{
            miz[i].a=rand();
            miz[i].b=rand();
        }while(niz[i].a!=miz[i].a*miz[i].b);
        do{
            miz1[i].a=rand();
            miz1[i].b=rand();
        }while(niz[i].b!=miz[i].a^miz[i].b);
        }while(miz[i].a==miz1[i].a && miz[i].b==miz1[i].b);
    }
    for(i=0;i<n;i++){
        cout<<miz[i].a;
        cout<<" ";
        cout<<miz[i].b;
        cout<<"\n";
    }
    return 0;
}