#include <bits/stdc++.h>
using namespace std;
const int i4 = 748683265, P = 998244353;
long long f[1 << 17], g[1 << 17], h[1 << 17], d[1 << 17], x, y, z, p, q, r, s;
int a, b, c, n, k, N, al;
long long ksm(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1, a = 1ll * a * a % P)
    if (b & 1) ans = ans * a % P;
  return ans;
}
void fwt(long long *a) {
  for (int mid = 1; mid < N; mid <<= 1)
    for (int R = mid << 1, j = 0; j < N; j += R)
      for (int k = (0); k <= (mid - 1); ++k) {
        int x = a[j + k];
        a[j + k] = (x + a[j + mid + k]) % P;
        a[j + mid + k] = (x - a[j + mid + k] + P) % P;
      }
}
int main() {
  scanf("%d%d", &n, &k);
  N = 1 << k;
  scanf("%lld%lld%lld", &x, &y, &z);
  for (int i = (1); i <= (n); ++i)
    scanf("%d%d%d", &a, &b, &c), b ^= a, c ^= a, ++f[b], ++g[c], ++h[b ^ c],
        al ^= a;
  fwt(f);
  fwt(g);
  fwt(h);
  for (int i = (0); i <= (N - 1); ++i) {
    p = (n + f[i] + g[i] + h[i]) % P * i4 % P;
    q = ((n + f[i] - g[i] - h[i]) % P + P) % P * i4 % P;
    r = ((n + g[i] - f[i] - h[i]) % P + P) % P * i4 % P;
    s = ((n + h[i] - f[i] - g[i]) % P + P) % P * i4 % P;
    d[i] = 1;
    d[i] = d[i] * ksm(((x + y) % P + z) % P, p) % P;
    d[i] = d[i] * ksm(((x + y) % P - z + P) % P, q) % P;
    d[i] = d[i] * ksm(((x - y + P) % P + z) % P, r) % P;
    d[i] = d[i] * ksm(((x - y + P) % P - z + P) % P, s) % P;
  }
  fwt(d);
  long long inv = ksm(2, P - 1 - k);
  for (int i = (0); i <= (N - 1); ++i)
    printf("%lld%c", d[i ^ al] * inv % P, " \n"[i == N - 1]);
  return 0;
}
