#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; if (!(cin >> N >> M)) return 0; for (int i = 0; i < M; ++i) { int u, v; cin >> u >> v; if (u < v) { cout << 0 << endl; } else { cout << 1 << endl; } } return 0; }