#include <bits/stdc++.h>   using namespace std;   long long a[100001], flag[100001];   vector<pair<long long, long long> > ans;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n, sum = 0;     cin >> n;     for (long long i = 0; i < n; i++) {       cin >> a[i];       sum += a[i];     }     sum /= n / 2;     for (long long i = 0; i < n; i++) {       if (flag[i] == 0)         for (long long j = i + 1; j < n; j++) {           if (flag[j] == 0 && ((a[i] + a[j]) == sum)) {             flag[j] = 1;             flag[i] = 1;             ans.push_back(make_pair(i + 1, j + 1));             break;           }         }     }     for (auto i : ans) {       cout << i.first <<     << i.second << endl;     }     return 0;   }   