func_code_string: #include <bits/stdc++.h>   using namespace std;   string moves[] = { MW ,  LW ,  LM };   int sequence[25];   void listify(int k, int n) {     for (int i = 0; i != n; ++i) {       sequence[i] = k % 3;       k /= 3;     }   }   void solve(int n, vector<vector<int> >& V) {     int n1 = n / 2;     int n2 = n - n1;     int k1 = pow(3, n1), k2 = pow(3, n2);     vector<int> state(3);     map<pair<int, int>, pair<int, int> > sums;     for (int k = 0; k != k1; ++k) {       listify(k, n1);       state[0] = state[1] = state[2] = 0;       for (int i = 0; i != n1; ++i) {         state[(sequence[i] + 1) % 3] += V[i][(sequence[i] + 1) % 3];         state[(sequence[i] + 2) % 3] += V[i][(sequence[i] + 2) % 3];       }       pair<int, int> p(state[1] - state[0], state[2] - state[0]);       if (sums.find(p) == sums.end() || sums[p].first < state[0]) {         sums[p] = make_pair(state[0], k);       }     }     int max_equal_rel = -1000000000;     pair<int, int> argmax;     for (int k = 0; k != k2; ++k) {       listify(k, n2);       state[0] = state[1] = state[2] = 0;       for (int i = 0; i != n2; ++i) {         state[(sequence[i] + 1) % 3] += V[i + n1][(sequence[i] + 1) % 3];         state[(sequence[i] + 2) % 3] += V[i + n1][(sequence[i] + 2) % 3];       }       pair<int, int> p(state[0] - state[1], state[0] - state[2]);       if (sums.find(p) != sums.end() &&           sums[p].first + state[0] > max_equal_rel) {         max_equal_rel = sums[p].first + state[0];         argmax = make_pair(sums[p].second, k);       }     }     if (max_equal_rel == -1000000000) {       cout <<  Impossible  << endl;     } else {       listify(argmax.first, n1);       for (int i = 0; i != n1; ++i) {         cout << moves[sequence[i]] << endl;       }       listify(argmax.second, n2);       for (int i = 0; i != n2; ++i) {         cout << moves[sequence[i]] << endl;       }     }   }   int main() {     int n;     cin >> n;     vector<vector<int> > V(n, vector<int>(3));     for (int i = 0; i != n; ++i) {       cin >> V[i][0] >> V[i][1] >> V[i][2];     }     solve(n, V);     return 0;   }   