#include using namespace std; using ll = long long; int A, B; int gcd(int a, int b){ if(b == 0)return a; return gcd(b, a % b); } int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> A >> B; int L = A * A + B * B; int g = gcd(A, B); L /= g; for(int x = 0;x < L * g;x += L){ for(int y = 0;y < L * g;y += L){ for(int i = 0;i < L / g;i++){ cout << x + i * A % L << " " << y + i * B % L << "\n"; } } } for(int x = 0;x < L * g;x += L){ for(int y = 0;y < L * g;y += L){ for(int i = 0;i < L / g;i++){ cout << x + (i + 1) * A % L << " " << y + i * B % L << "\n"; } } } return 0; }