#include using namespace std; #define rep(i, a, n) for(int i = a; i < n; i++) #define rrep(i, a, n) for(int i = a; i >= n; i--) #define ll long long #define pii pair #define pll pair constexpr ll MOD = 1000000007; constexpr int IINF = 1001001001; constexpr ll INF = 1LL<<60; template void chmax(t&a,u b){if(a void chmin(t&a,u b){if(b> n; vector> card(n); rep(i, 0, n){ ll a, b; cin >> a >> b; card[i] = {a, b, i+1}; } sort(card.begin(), card.end()); vector> ope; rep(_, 0, 2){ rep(__, 0, 25){ // 1~25回目は表、26~50回目は裏が最大, 最小となるカードについて操作を行う auto [a, c, i] = card[0]; auto [b, d, j] = card[n-1]; card[0] = {(a+b)/2, (c+d)/2, i}; card[n-1] = {(a+b)/2, (c+d)/2, j}; ope.push_back({i, j}); sort(card.begin(), card.end()); } rep(i, 0, n){ auto [a, c, j] = card[i]; card[i] = {c, a, j}; } } // 出力 cout << ope.size() << endl; for(auto [u, v]: ope){ cout << u << ' ' << v << endl; } // // スコア // ll base = 5e17; // rep(i, 0, n){ // auto [a, c, j] = card[i]; // if(j == 1){ // cout << (ll)(2e6-1e5*log10(max(abs(a-base), abs(c-base))+1)) << endl; // } // } return 0; }