func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   int ansx[maxn], ansy[maxn];   int b[maxn], c[maxn];   struct node {     int g, p, t, id;     node() {}     node(int g, int p, int t, int id) {       this->g = g;       this->p = p;       this->t = t;       this->id = id;     }   } a[maxn], init[maxn];   bool cmp(node x, node y) {     return (x.t - x.p) < (y.t - y.p) || ((x.t - x.p) == (y.t - y.p) && x.p < y.p);   }   int main() {     std::ios::sync_with_stdio(false);     int n, w, h;     cin >> n >> w >> h;     for (int i = 1; i <= n; i++) {       cin >> a[i].g >> a[i].p >> a[i].t;       a[i].id = i;       init[i] = a[i];     }     sort(a + 1, a + 1 + n, cmp);     int now = 1;     while (now <= n) {       int t1 = 0, t2 = 0;       if (a[now].g == 1)         b[t1++] = a[now].id;       else         c[t2++] = a[now].id;       now++;       while (now <= n && (a[now].t - a[now].p == a[now - 1].t - a[now - 1].p)) {         if (a[now].g == 1)           b[t1++] = a[now].id;         else           c[t2++] = a[now].id;         now++;       }       for (int i = 0; i < t1; i++) {         int lastx = t1 - i - 1;         int lasty = t2;         if (lastx < lasty) {           ansx[b[i]] = w;           ansy[b[i]] = init[c[lastx]].p;         } else {           ansx[b[i]] = init[b[i + lasty]].p;           ansy[b[i]] = h;         }       }       for (int i = 0; i < t2; i++) {         int lastx = t1;         int lasty = t2 - i - 1;         if (lastx > lasty) {           ansy[c[i]] = h;           ansx[c[i]] = init[b[lasty]].p;         } else {           ansx[c[i]] = w;           ansy[c[i]] = init[c[i + lastx]].p;         }       }     }     for (int i = 1; i <= n; i++) printf( %d %d n , ansx[i], ansy[i]);     return 0;   }   