#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void solve() { ll a, b; cin >> a >> b; bool swapped = false; if (a > b) { swap(a, b); swapped = true; } vector>> ans(2); bool first = true; ll L = a * a + b * b; for (ll i = 0, j = 0; first || (i != 0 && j != 0); i += a, j += b, i %= L, j %= L) { ans[0].emplace_back(i, j); ans[1].emplace_back((i + a) % L, j); first = false; } if (swapped) swap(ans[0], ans[1]); rep(i, 2) rep(j, ans[i].size()) { cout << ans[i][j].first << ' ' << ans[i][j].second << '\n'; } } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }