#include "bits/stdc++.h"
using namespace std;

//

#define RESIDUE(u,v) (capacity[u][v] - flow[u][v])
#define RCOST(u,v) (cost[u][v] + h[u] - h[v])
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define LL long long

template <typename T>
class graph {
  public:
  struct edge {
    int from;
    int to;
    T cost;
  };
 
  vector <edge> edges;
  vector < vector <int> > g;
  int n;
 
  graph(int n) : n(n) {
    g.resize(n);
  }
 
  virtual void add(int from, int to, T cost = 0){
    assert(0 <= from && from < n && 0 <= to && to < n);
    g[from].push_back(edges.size());
    g[to].push_back(edges.size());
    edges.push_back({from,to,cost});
  }
};
 
template <typename T>
class undigraph : public graph<T> {
  public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;
 
  undigraph(int n) : graph<T>(n) {
  }
 
  void add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    g[from].push_back(edges.size());
    g[to].push_back(edges.size());
    edges.push_back({from, to, cost});
  }
};
 
template <typename T>
vector <T> dijkstra(const graph<T> &g, int start) {
  assert(0 <= start && start < g.n);
  vector<T> dist(g.n, numeric_limits<T>::max());
  priority_queue<pair<T, int>, vector<pair<T, int> >, greater<pair<T, int> > > s;
  dist[start] = 0;
  s.emplace(dist[start], start);
  while (!s.empty()) {
    int expected = s.top().first;
    int i = s.top().second;
    s.pop();
    if (dist[i] != expected) {
      continue;
    }
    for (int id : g.g[i]) {
      auto &e = g.edges[id];
      int to = e.from ^ e.to ^ i;
      if (dist[i] + e.cost < dist[to]) {
        dist[to] = dist[i] + e.cost;
        s.emplace(dist[to], to);
      }
    }
  }
  return dist;
  // returns numeric_limits<T>::max() if there's no path
}

int visited[300*300*4];

template <typename T>
bool bipartite(const graph<T> &g, int start, int color){
  if(visited[start]!=-1 && visited[start]!=color)
    return true;
  if(visited[start]!=-1)
    return false;
  visited[start]=color;
  bool ret=false;
  REP(i,g.g[start].size()){
    ret = ret | bipartite(g,g.edges[g.g[start][i]].to,1-color);
  }
  return ret;
}

int n;

int p2i(int i,int j){
  return 2*n*i+j;
}

pair<int,int> i2p(int i){
  pair<int,int> p = make_pair(i/(2*n),i%(2*n));
  return p;
}

vector<pair<int,int>> points[2];

void prep(int d1,int d2){
  int lim;
  lim = 1+(int)floor(sqrt((double)d1));
  REP(i,lim){
    REP(j,lim){
      if(i*i+j*j==d1)
	points[0].push_back(make_pair(i,j));
    }
  }
  lim = 1+(int)floor(sqrt((double)d2));
  REP(i,lim){
    REP(j,lim){
      if(i*i+j*j==d2)
	points[1].push_back(make_pair(i,j));
    }
  }
  
}

int frame[2] = {-1,1};

vector<int> nbh(int ni,int nj,int gn){
  vector<int> ret;
  REP(k,points[gn].size()){
    REP(i,2){
      REP(j,2){
	pair<int,int> p = points[gn][k];
	if(ni+frame[i]*p.first >= 0 && ni+frame[i]*p.first < 2*n &&
	   nj+frame[j]*p.second >= 0 && nj+frame[j]*p.second < 2*n){
	  auto p_tmp = make_pair(ni+frame[i]*p.first
				 ,nj+frame[j]*p.second);
	  ret.push_back(p2i(p_tmp.first,p_tmp.second));
	}
      }
    }
  }
  return ret;
}

vector<int> indep[2][2];

int d[2];

int main(){
  cin>>n>>d[0]>>d[1];

  undigraph<int> g[2](4*n*n);
  vector<int> tmp;

  prep(d[0],d[1]);

  REP(i,2*n){
    REP(j,2*n){
      REP(gn,2){
	tmp = nbh(i,j,gn);
	REP(k,tmp.size())
	  g[gn].add(p2i(i,j),tmp[k]);
      }
    }
  }
  
  REP(gn,2){
    REP(j,4*n*n)
      visited[j]=-1;
    REP(idx,4*n*n){
      if(visited[idx]>=0)continue;
      bipartite(g[gn],idx,0);
    }
    REP(i,4*n*n)
      indep[gn][visited[i]].push_back(i);
  }

  REP(i,2){
    REP(j,2){
      sort(indep[i][j].begin(),indep[i][j].end());
    }
  }
  
  REP(i,2){
    REP(j,2){
      vector<int> v(4*n*n);
      vector<int>::iterator it;
      it = set_intersection(indep[0][i].begin(),indep[0][i].end()
			    ,indep[1][j].begin(),indep[1][j].end(),v.begin());
      v.resize(it-v.begin());
      if(v.size()>=n*n){
	pair<int,int> p;
	REP(k,n*n){
	  p = i2p(v[k]);
	  cout<<p.first<<" "<<p.second<<endl;
	}
	return 0;
      }
    }
  }
  
  return 0;
}


Measured memory_bytes: 347704