#include <bits/stdc++.h>
using namespace std;
const int Maxn = 140000;
const int inf = 2147483647;
const long long mod = 998244353, inv = (mod + 1) / 2;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
long long A[Maxn], B[Maxn], C[Maxn], ans[Maxn];
void fwt(long long *a, int n, int o) {
  for (int i = 1; i < n; i <<= 1)
    for (int j = 0; j < n; j += (i << 1))
      for (int k = 0; k < i; k++) {
        long long x = a[j + k], y = a[i + j + k];
        a[j + k] = x + y;
        a[i + j + k] = x - y;
        if (o == -1) {
          a[j + k] = (a[j + k] % mod + mod) % mod;
          a[j + k] = a[j + k] * inv % mod;
          a[i + j + k] = (a[i + j + k] % mod + mod) % mod;
          a[i + j + k] = a[i + j + k] * inv % mod;
        }
      }
}
int Pow(long long x, long long y) {
  x = (x % mod + mod) % mod;
  if (!y) return 1;
  int t = Pow(x, y >> 1), re = (long long)t * t % mod;
  if (y & 1) re = (long long)re * x % mod;
  return re;
}
int n, k, x, y, z;
int main() {
  n = read(), k = (1 << read());
  x = read(), y = read(), z = read();
  int s = 0;
  for (int i = 1; i <= n; i++) {
    int a = read(), b = read(), c = read();
    s ^= a;
    A[a ^ b]++, B[a ^ c]++, C[b ^ c]++;
  }
  fwt(A, k, 1), fwt(B, k, 1), fwt(C, k, 1);
  for (int i = 0; i < k; i++) {
    long long a, b, c, d;
    a = (n + A[i] + B[i] + C[i]) / 4LL;
    b = (n + A[i] - B[i] - C[i]) / 4LL;
    c = (n + B[i] - A[i] - C[i]) / 4LL;
    d = n - a - b - c;
    ans[i] = (long long)Pow((long long)x + y + z, a) *
             Pow((long long)x + y - z, b) % mod * Pow((long long)x - y + z, c) %
             mod * Pow((long long)x - y - z, d) % mod;
  }
  fwt(ans, k, -1);
  for (int i = 0; i < k; i++) printf("%lld ", ans[i ^ s]);
}
