#include #include using namespace std; struct Coord { int x, y; Coord(int _x, int _y) { x = _x; y = _y; } }; int n = 200; int z; queue q; Coord queue_pop() { Coord current = q.front(); q.pop(); return current; } int main() { q.push(Coord(0, 0)); while (!q.empty()) { Coord current = queue_pop(); q.pop(); cout << current.x << " " << current.y << "\n"; cin >> z; if (z == 0) { break; } int both = 0; if (current.x < n - 1) { both++; q.push(Coord(current.x + 1, current.y)); } if (current.y < n - 1) { both++; q.push(Coord(current.x, current.y + 1)); } if (both == 2) { q.push(Coord(current.x + 1, current.y + 1)); } } return 0; }