#include <bits/stdc++.h>
using namespace std;
long long mul(long long a, long long b) {
  if (!b) return 1;
  long long k = mul(a, b / 2);
  if (b & 1) return k * k % 998244353 * a % 998244353;
  return k * k % 998244353;
}
int n, k, N;
long long A[200010], B[200010], C[200010], a, b, c, sum;
long long f[200010], g[200010], h[200010];
void FWT(long long *v, int dir) {
  long long inv2 = mul(2, 998244353 - 2);
  for (int i = 1; i < N; i <<= 1)
    for (int j = 0; j < N; j += 2 * i)
      for (int k = 0; k < i; k++) {
        long long x = v[j + k], y = v[j + k + i];
        v[j + k] = (x + y) * (dir == -1 ? inv2 : 1) % 998244353;
        v[j + k + i] = (x - y + 998244353) * (dir == -1 ? inv2 : 1) % 998244353;
      }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> a >> b >> c;
  N = (1 << k);
  for (int i = 0; i < n; i++) {
    cin >> A[i] >> B[i] >> C[i];
    f[B[i] ^ A[i]]++, g[C[i] ^ A[i]]++, h[B[i] ^ C[i]]++;
    sum ^= A[i];
  }
  FWT(f, 1), FWT(g, 1), FWT(h, 1);
  long long ans = 1;
  long long X = (a + b + c) % 998244353,
            Y = (a + b - c + 998244353) % 998244353,
            Z = (a - b + c + 998244353) % 998244353,
            W = (a - b - c + 2 * 998244353) % 998244353;
  long long inv2 = mul(2, 998244353 - 2);
  for (int i = 0; i < N; i++) {
    long long x = (n + f[i] + g[i] + h[i]) % 998244353 * inv2 % 998244353 *
                  inv2 % 998244353,
              y = ((n + f[i]) % 998244353 * inv2 % 998244353 - x + 998244353) %
                  998244353,
              z = ((n + g[i]) % 998244353 * inv2 % 998244353 - x + 998244353) %
                  998244353,
              w = ((n + h[i]) % 998244353 * inv2 % 998244353 - x + 998244353) %
                  998244353;
    f[i] = mul(X, x) * mul(Y, y) % 998244353 * mul(Z, z) % 998244353 *
           mul(W, w) % 998244353;
  }
  FWT(f, -1);
  for (int i = 0; i < N; i++) cout << f[sum ^ i] << ' ';
  cout << endl;
  return 0;
}
