#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#define lol(i,n) for(ll i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define X 610
ll n;
class Con{
  public:
  vector<pair<ll,ll> > g[X][X];
  ll s[X][X];
  void dfs(ll x,ll y,ll c){
    if(~s[x][y])return;
    s[x][y]=c;
    for(auto t:g[x][y]){
      dfs(t.first,t.second,1^c);
    }
  }
  void main(ll d){
    vector<ll> x,y;
    for(int i=-X;i<X;i++)for(int j=-X;j<X;j++){
      if(i*i+j*j==d){
	x.push_back(i); y.push_back(j);
      }
    }
    lol(i,n)lol(j,n){
      for(int k=0;k<x.size();k++){
	ll xx=i+x[k],yy=j+y[k];
	if(xx<0||yy<0||xx>=n||yy>=n)continue;
	g[i][j].push_back(make_pair(xx,yy));
      }
    }
    lol(i,n)lol(j,n)s[i][j]=-1;
    lol(i,n)lol(j,n)dfs(i,j,0);
  }
};Con co[2];
int main(){
    cin>>n;n*=2;
    lol(i,2){
      ll d;
      cin>>d;
      co[i].main(d);
    }
    vector<pair<ll,ll> >v[2][2];
    lol(i,n)lol(j,n){
      v[co[0].s[i][j]][co[1].s[i][j]].push_back(make_pair(i,j));
    }
    lol(i,2)lol(j,2)if(v[i][j].size()>=n*n/4){
      for(int k=0;k<n*n/4;k++){
	cout<<v[i][j][k].first<<" "<<v[i][j][k].second<<endl;
      }
      return 0;
    }
    return 0;
}

#include <bits/stdc++.h>
int read(){
	int x=0,f=1;
	char ch=getchar();
	while (ch<'0' || ch>'9'){
		if (ch=='-') f=-1;
		ch=getchar();
	}
	while (ch>='0' && ch<='9'){
		x=x*10+ch-'0';ch=getchar();
	}
	return x*f;
}
const int N=600;
int n,d1,d2,col[2][N*N];
std::vector< std::pair<int,int> > v[2];
inline int id(const int &x,const int &y) {
    return x*N+y;
}
inline bool check(const int &x) {
    return 0<=x && x<n*2;
}
void dfs(const int &x,const int &t) {
    const int i=x/N,j=x%N;
    for (auto &d:v[t]) {
        const int nx=i+d.first,ny=j+d.second;
        if (!check(nx)||!check(ny)) continue;
        const int y=id(i+d.first,j+d.second);
        if (!col[t][y]) {
            col[t][y]=col[t][x]==1?2:1;
            dfs(y,t);
        }
    }
}
int main() {
    n=read(),d1=read(),d2=read();
    for (register int i=0;i<=d1;i++) {
        const int j=sqrt(d1-i*i);
        if (i*i+j*j!=d1) continue;
        v[0].emplace_back(std::make_pair(i,j));
        v[0].emplace_back(std::make_pair(-i,j));
        v[0].emplace_back(std::make_pair(i,-j));
        v[0].emplace_back(std::make_pair(-i,-j));
    }
    for (register int i=0;i<=d2;i++) {
        const int j=sqrt(d2-i*i);
        if (i*i+j*j!=d2) continue;
        v[1].emplace_back(std::make_pair(i,j));
        v[1].emplace_back(std::make_pair(-i,j));
        v[1].emplace_back(std::make_pair(i,-j));
        v[1].emplace_back(std::make_pair(-i,-j));
    }
    for (register int i=0;i<n*2;i++) {
        for (register int j=0;j<n*2;j++) {
            if (!col[0][id(i,j)]) {
                col[0][id(i,j)]=1;
                dfs(id(i,j),0);
            }
            if (!col[1][id(i,j)]) {
                col[1][id(i,j)]=1;
                dfs(id(i,j),1);
            }
        }
    }
    for (register int i=0,cnt=0;i<n*2;i++){
        for (register int j=0;j<n*2;j++) {
            if (col[0][id(i,j)]==1 && col[1][id(i,j)]==1) {
                printf("%d %d\n",i,j);
                if (++cnt==n*n) return 0;
            }
        }
    }
}
