func_code_string: #include <bits/stdc++.h>   using namespace std;   #define int long long   struct node{    int x, y, id;    bool operator <(const node& W) const{     if (W.x != x) return x < W.x;     else return y < W.y;    }   };      void work() {    int n;    cin >> n;    vector<node> v(n);    for (int i = 0; i < n; i++) {     int x, y;     cin >> x >> y;     if (x > y) swap(x, y);     v[i] = {x, y, i + 1};    }    sort(v.begin(), v.end());    vector<int> res(n + 1);    int pos = -1;        for (int i = 0; i < v.size(); i++) {     int j = i;     while (j < v.size() && v[i].x == v[j].x) j++;     j--;     if (pos == -1) for (int k = i; k <= j; k++) res[v[k].id] = -1;     else {      for (int k = i; k <= j; k++)        if (v[k].y > v[pos].y) res[v[k].id] = v[pos].id;       else res[v[k].id] = -1;     }     if (pos == -1) pos = 0;     else if (v[i].y < v[pos].y) pos = i;     i = j;    }        for (int i = 1; i < res.size(); i++) cout << res[i] <<    ;    cout << endl;   }   int32_t main() {    ios::sync_with_stdio(false);    cin.tie(0);    int cas;    cin >> cas;    while (cas--) work();    return 0;   }