#include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2") #define REP(i, N) for (int i = 0; i < (int)N; i++) #define FOR(i, a, b) for (int i = a; i < (int)b; i++) #define ALL(v) v.begin(), v.end() using namespace std; using ll = long long; using Pii = pair; constexpr int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[8] = {0, 1, 1, 1, 0, -1, -1, -1}; struct Timer { static constexpr double ONE_CLOCK = 0.000000333; unsigned long long get_cycle() { unsigned int low, high; __asm__ volatile("rdtsc" : "=a"(low), "=d"(high)); return ((unsigned long long int)low) | ((unsigned long long int)high << 32); } unsigned long long start_time, last_time; Timer() { start_time = last_time = get_cycle(); } int get_time() { return get_cycle() * ONE_CLOCK - start_time * ONE_CLOCK; } int split_time() { return get_cycle() * ONE_CLOCK - last_time * ONE_CLOCK; } void split() { last_time = get_cycle(); } } timer; class RandInt { public: int x = 8753, y = 239017, z = 1000000123; int next(int d) { int t = x ^ (x << 11); x = y; y = z; z ^= (z >> 19) ^ t ^ (t >> 8); return z % d; } } ri; template string to_string(T s); template string to_string(pair p); string to_string(char c) { return string(1, c); } string to_string(string s) { return s; } string to_string(const char s[]) { return string(s); } template string to_string(T v) { if (v.empty()) return "{}"; string ret = "{"; for (auto x : v) ret += to_string(x) + ","; ret.back() = '}'; return ret; } template string to_string(pair p) { return "{" + to_string(p.first) + ":" + to_string(p.second) + "}"; } void debug() { cerr << endl; } template void debug(Head head, Tail... tail) { cerr << to_string(head) << " "; debug(tail...); } template bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } template struct FQueue { TP arr[SZ]; int head = 0, tail = 0; int size() { return head <= tail ? tail - head : (tail + SZ - head); } void push(TP p) { arr[tail++] = p; if (tail == SZ) tail = 0; } void clear() { head = tail = 0; } TP front() { return arr[head]; } bool empty() { return head == tail; } TP pop() { TP ret = arr[head++]; if (head == SZ) head = 0; return ret; } }; #include struct Point { int x, y; Point() {} Point(int _y, int _x) : x(_x), y(_y) {} }; constexpr int N = 3000, T = 400; Point s[N], t[N]; ll u = 1000000, v = 1; struct Judge { int local = 0; void read_problem() { if (local) { } else { int _; cin >> _ >> _; REP(i, N) { cin >> s[i].y >> s[i].x >> t[i].y >> t[i].x; } } } void get() { if (local) { } else { cin >> u >> v; } } void build(int x, int y, int z, int w) { cout << 1 << " " << x << " " << y << " " << z << " " << w << endl; } void gather() { cout << 2 << endl; } void donate() { cout << 3 << endl; } } judge; ll get_cost() { return 10000000 / sqrt(v); } constexpr int inf = 1 << 27; int main(int argc, char **argv) { if (argc == 2) { judge.local = 1; } judge.read_problem(); queue> que; FOR(i, 6, 10) { que.emplace(i, i, i + 1, i); que.emplace(i, i, i, i + 1); } REP(q, T) { judge.get(); if (v < 25) { judge.gather(); } else if (q < 300 && !que.empty() && get_cost() <= u) { auto tp = que.front(); que.pop(); judge.build(get<0>(tp), get<1>(tp), get<2>(tp), get<3>(tp)); } else { judge.donate(); } } return 0; }