//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//int sq[1234567],hassq[1234567];
vii getind(vii vec,int val){
	vii vec1,vec2,vec3,vec4,vec00,vec11,vec22,vec33,vec0;

	vec1.clear();
	int i;
	int haha[3];
	int wow[2][2];
	rep(i,2){
		haha[i]=0;
	}
	int j;
	rep(i,2){
		rep(j,2){
			wow[i][j]=0;
		}
	}

	if(val%2){
		rep(i,vec.size()){
			haha[(vec[i].ff+vec[i].ss)%2]++;
		}
		val=0;
		if(haha[1]>haha[0]){
			val=1;
		}
		rep(i,vec.size()){
			if((vec[i].ff+vec[i].ss)%2==val){
				vec1.pb(vec[i]);
			}
		}
		return vec1;
	}
	if(val%4==2){
		rep(i,vec.size()){
			wow[vec[i].ff%2][vec[i].ss%2]++;
		}
		if(wow[0][0]>wow[1][1]){
			rep(i,vec.size()){
				if(vec[i].ff%2==0 && vec[i].ss%2==0){
					vec1.pb(vec[i]);
				}
			}
		}
		else{
			rep(i,vec.size()){
				if(vec[i].ff%2==1 && vec[i].ss%2==1){
					vec1.pb(vec[i]);
				}
			}
		}
		if(wow[1][0]>wow[0][1]){
			rep(i,vec.size()){
				if(vec[i].ff%2==1 && vec[i].ss%2==0){
					vec1.pb(vec[i]);
				}
			}
		}
		else{
			rep(i,vec.size()){
				if(vec[i].ff%2==0 && vec[i].ss%2==1){
					vec1.pb(vec[i]);
				}
			}
		}
		return vec1;

	}
	if(val%4==0){
		val/=4;
		rep(i,vec.size()){
			int hahal=(vec[i].ff%2)*2+vec[i].ss%2;
			vec[i].ff/=2;
			vec[i].ss/=2;
			if(hahal==0){
				
				vec0.pb(vec[i]);
			}
			else if(hahal==1){
				vec1.pb(vec[i]);
			}
			else if(hahal==2){
				vec2.pb(vec[i]);
			}
			else if(hahal==3){
				vec3.pb(vec[i]);
			}

		}
		vec00=getind(vec0,val);
		vec11=getind(vec1,val);
		vec22=getind(vec2,val);
		vec33=getind(vec3,val);
		vec1.clear();
		rep(i,vec00.size()){
			vec00[i].ff*=2;
			vec00[i].ss*=2;
			vec1.pb(vec00[i]);
		}
		rep(i,vec11.size()){
			vec11[i].ff*=2;
			vec11[i].ss*=2;
			//vec00[i].ff++;
			vec11[i].ss++;
			vec1.pb(vec11[i]);
		}
		rep(i,vec22.size()){
			vec22[i].ff*=2;
			vec22[i].ss*=2;
			vec22[i].ff++;
			vec1.pb(vec22[i]);
		}
		rep(i,vec33.size()){
			vec33[i].ff*=2;
			vec33[i].ss*=2;
			vec33[i].ff++;
			vec33[i].ss++;
			vec1.pb(vec33[i]);
		}
		return vec1;
	}
}
int main(){
    std::ios::sync_with_stdio(false);
    int n,d1,d2;
    cin>>n>>d1>>d2;
    int i,j;
    vii vec;
    rep(i,2*n){
    	rep(j,2*n){
    		vec.pb(mp(i,j));
    	}
    }
    vii vec1,vec2;
    vec1=getind(vec,d1);
    vec2=getind(vec1,d2);
    rep(i,n*n){
    	cout<<vec2[i].ff<<" "<<vec2[i].ss<<endl;
    }

    
}

Measured memory_bytes: 15980