#include #include #include #include #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int N, M; int ALPHA = 5; vector> position_list; // [0 : N) ... planet, [N : N + M) ... station int get_distance(int a, int b) { int alpha = 1; if (a < N) { alpha *= ALPHA; } if (b < N) { alpha *= ALPHA; } auto& p = position_list[a]; auto& q = position_list[b]; return alpha * (p.first - q.first) * (p.first - q.first) + (p.second - q.second) * (p.second - q.second); } int main() { cin >> N >> M; position_list.assign(N + M, make_pair(0, 0)); rep (i, N) { cin >> position_list[i].first >> position_list[i].second; } position_list[N + 0] = make_pair(0, 0); position_list[N + 1] = make_pair(0, 500); position_list[N + 2] = make_pair(0, 1000); position_list[N + 3] = make_pair(500, 0); position_list[N + 4] = make_pair(500, 1000); position_list[N + 5] = make_pair(1000, 0); position_list[N + 6] = make_pair(1000, 500); position_list[N + 7] = make_pair(1000, 1000); size_t max_ans_size = 100'000; vector ans; rep (i, N + M) { rep (j, N + M) { if (i != j) { ans.push_back(i); ans.push_back(j); } } } int v, w; int max_dist = -1; rep (i, N + M) { rep (j, N + M) { if (int d = get_distance(i, j); d > max_dist) { max_dist = d; v = i; w = j; } } } while (ans.size() < max_ans_size - 1) { if ((int)ans.size() % 2) { ans.push_back(v); } else { ans.push_back(w); } } ans.push_back(0); rep (i, M) { auto& [x, y] = position_list[N + i]; cout << x << " " << y << "\n"; } cout << (int)ans.size() << "\n"; rep (i, (int)ans.size()) { int x = ans[i]; if (x >= N) { cout << 2 << " " << x - N + 1 << "\n"; } else { cout << 1 << " " << x + 1 << "\n"; } } return 0; }