func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<pair<int, int>, int> > v, ans;   vector<pair<int, int> > an;   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int val, state;       cin >> val >> state;       v.push_back(make_pair(make_pair(val, !state), i));     }     sort(v.begin(), v.end());     int cur = 2;     for (int i = 0; i < m; i++) {       if (!v[i].first.second) {         if (cur > n) {           cout << -1;           return 0;         }         ans.push_back(make_pair(make_pair(cur, 1), v[i].second));         for (int j = 2; j < cur; j++) {           if (an.size() < m) {             an.push_back(make_pair(cur, j));           } else {             break;           }         }         cur++;       } else {         if (an.size() == 0) {           cout << -1;           return 0;         } else {           ans.push_back(make_pair(an[an.size() - 1], v[i].second));           an.pop_back();         }       }     }     int k = ans.size();     vector<pair<int, int> > out(k, make_pair(0, 0));     for (int i = 0; i < k; i++) {       out[ans[i].second] = ans[i].first;     }     for (int i = 0; i < k; i++) {       cout << out[i].first <<     << out[i].second << endl;     }     return 0;   }   