#include <bits/stdc++.h>
using namespace std;
const int N = 131080;
const int mod = 998244353;
const int inv2 = 499122177;
const int inv4 = 748683265;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int qpow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod, b >>= 1;
  }
  return ret;
}
int n, k, x, y, z, A[N], B[N], C[N], o, len, F[N], ans = 0;
void fwt(int *a, int f) {
  for (int i = 1; i < len; i <<= 1)
    for (int p = i << 1, j = 0; j < len; j += p)
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[j + k + i];
        a[j + k] = 1ll * (x + y >= mod ? x + y - mod : x + y) * f % mod,
              a[j + k + i] = 1ll * (x - y < 0 ? x - y + mod : x - y) * f % mod;
      }
}
int main() {
  n = gi(), k = gi(), x = gi(), y = gi(), z = gi(), len = 1 << k;
  for (int i = 1, a, b, c; i <= n; i++)
    o ^= (a = gi()), b = gi(), c = gi(), ++A[a ^ b], ++B[a ^ c], ++C[b ^ c];
  fwt(A, 1), fwt(B, 1), fwt(C, 1);
  int s1 = (1ll * x + y + z) % mod, s2 = (1ll * x + y - z + mod) % mod,
      s3 = (1ll * x - y + z + mod) % mod,
      s4 = (1ll * x - y - z + 2 * mod) % mod;
  for (int i = 0; i < len; i++) {
    int p = (1ll * n + A[i] + B[i] + C[i]) * inv4 % mod,
        q = (1ll * (n + A[i]) * inv2 - p + mod) % mod,
        r = (1ll * (n + B[i]) * inv2 - p + mod) % mod,
        s = (1ll * (n + C[i]) * inv2 - p + mod) % mod;
    F[i] = 1ll * qpow(s1, p) * qpow(s2, q) % mod * qpow(s3, r) % mod *
           qpow(s4, s) % mod;
  }
  fwt(F, inv2);
  for (int i = 0; i < len; i++) printf("%d ", F[i ^ o]);
  return 0;
}
