#include #include #include #include #include using namespace std; int N, T; int A[3009], B[3009], C[3009], D[3009]; int Build[1009]; int CountRoads = 0; vector> vec; int Distance(int sx, int sy) { return (sx * 2 - 11) * (sx * 2 - 11) + (sy * 2 - 11) * (sy * 2 - 11); } int main() { // Input cin >> N >> T; for (int i = 1; i <= N; i++) cin >> A[i] >> B[i] >> C[i] >> D[i]; for (int i = 1; i <= 1000; i++) Build[i] = (int)(10000000.0 / sqrt(1.0 * i)); // Sort Order for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 9; j++) vec.push_back(make_tuple(Distance(i, j) + Distance(i, j + 1), i, j, i, j + 1)); } for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 10; j++) vec.push_back(make_tuple(Distance(i, j) + Distance(i + 1, j), i, j, i + 1, j)); } sort(vec.begin(), vec.end()); // Interactive for (int i = 1; i <= T; i++) { int CurrentMoney; int CurrentCorp; cin >> CurrentMoney >> CurrentCorp; if (CurrentMoney == -1 && CurrentCorp == -1) break; cerr << CurrentMoney << " " << CurrentCorp << " " << CountRoads << endl; // 行動の設定 if (i <= 30) { cout << "3" << endl; } else if (i > 300) { cout << "3" << endl; } else if (CurrentMoney < Build[CurrentCorp]) { cout << "2" << endl; } else if (CountRoads < vec.size()) { int sx = get<1>(vec[CountRoads]); int sy = get<2>(vec[CountRoads]); int tx = get<3>(vec[CountRoads]); int ty = get<4>(vec[CountRoads]); cout << "1 " << sx << " " << sy << " " << tx << " " << ty << endl; CountRoads += 1; } else { cout << "2" << endl; } } return 0; }