#include #define MAX 10000 #define BASE 10 long long a[MAX]; long long dist(long long x, long long y) { long long d = 0; while (x||y) { if ((x%BASE) != (y%BASE)) { d++; } x /= BASE; y /= BASE; } return d; } int main() { long long n = -1; for (long long v=0;; v++) { bool ok = true; for (long long k=n; k>=0; k--) { if (dist(v, a[k])<3) { ok = false; break; } } if (ok) { n++; a[n] = v; printf("%lld %lld\n", n, v); fflush(stdout); if (n+1==MAX) { break; } } } return 0; }