#include using namespace std; using pii = pair; using ll = long long; const int N = 2000010, MOD = 998244353, INF = 0x3f3f3f3f; int n, m, w[N]; void solve() { cin >> n >> m; for (int i = 1; i < m + 1; i++) { int a, b; scanf("%d%d", &a, &b); if (a < b) puts("0"); else puts("1"); fflush(stdout); } } int main() { int T = 1; // cin >> T; while (T--) solve(); return 0; }