func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:102400000,102400000 )   template <class T>   inline void gmax(T &a, T b) {     if (b > a) a = b;   }   template <class T>   inline void gmin(T &a, T b) {     if (b < a) a = b;   }   using namespace std;   const int N = 1e5 + 10, M = 2e6 + 10, Z = 1e9 + 7, maxint = 2147483647,             ms1 = 16843009, ms31 = 522133279, ms63 = 1061109567,             ms127 = 2139062143;   const double PI = acos(-1.0), eps = 1e-8;   void fre() {     freopen( /Users/luras/Desktop/in.txt ,  r , stdin);     freopen( /Users/luras/Desktop/out.txt ,  w , stdout);   }   const int INF = 1e9;   int casenum, casei;   const int top = 1e5, top2 = top + top;   int g, n, m, b[N], c[N];   struct A {     int typ, p, t, o, v;     bool operator<(const A &b) const { return p < b.p; }   } a[N];   pair<int, int> ans[N];   vector<int> sot1[N + top], sot2[N + top];   int main() {     while (~scanf( %d%d%d , &g, &n, &m)) {       for (int i = 1; i <= g; i++) {         scanf( %d%d%d , &a[i].typ, &a[i].p, &a[i].t);         a[i].o = i;       }       sort(a + 1, a + g + 1);       for (int i = 1; i <= g; i++) {         a[i].v = a[i].t - a[i].p;         if (a[i].typ == 1)           ans[a[i].o] = {a[i].p, m};         else           ans[a[i].o] = {n, a[i].p};         if (a[i].typ == 2)           sot2[a[i].v + top].push_back(a[i].o);         else           sot1[a[i].v + top].push_back(a[i].o);       }       for (int i = 1; i <= top2; i++) {         int t1 = sot1[i].size(), t2 = sot2[i].size(), t3 = min(t1, t2);         for (int j = t1 - 1, k = 0; j >= t1 - t3; j--, k++) {           b[sot1[i][j]] = sot2[i][k];         }         for (int j = t2 - 1, k = 0; j >= t2 - t3; j--, k++) {           b[sot2[i][j]] = sot1[i][k];         }         if (t1 > t2) {           for (int j = 0, k = t3; j < t1 - t3; j++, k++) {             b[sot1[i][j]] = sot1[i][k];           }         } else if (t2 > t1) {           for (int j = 0, k = t3; j < t2 - t3; j++, k++) {             b[sot2[i][j]] = sot2[i][k];           }         }       }       for (int i = 1; i <= g; i++) {         printf( %d %d n , ans[b[i]].first, ans[b[i]].second);       }     }     return 0;   }   