#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353, inv2 = (mod + 1) >> 1;
const long long maxn = 1e6 + 5;
inline long long upd(const long long &x) {
  if (x < 0) return x + mod;
  if (x >= mod) return x - mod;
  return x;
}
inline long long ksm(long long x, long long k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = ans * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return ans;
}
inline void F(long long *f, long long n, long long h) {
  for (long long p = 1; p < n; p <<= 1)
    for (long long k = 0; k < n; k += p << 1)
      for (long long i = k; i < k + p; i++) {
        long long x = f[i], y = f[i + p];
        f[i] = x + y;
        f[i + p] = x - y;
        if (h == -1)
          f[i] = upd(f[i]) * inv2 % mod, f[i + p] = upd(f[i + p]) * inv2 % mod;
      }
}
long long n, m, x, y, z;
long long f[3][maxn];
long long ans[maxn];
signed main() {
  scanf("%lld%lld", &n, &m);
  m = 1 << m;
  scanf("%lld%lld%lld", &x, &y, &z);
  long long p = 0;
  for (long long i = (0); i <= (n - 1); i++) {
    long long a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);
    p ^= a;
    b ^= a;
    c ^= a;
    f[0][b]++;
    f[1][c]++;
    f[2][b ^ c]++;
  }
  F(f[0], m, 1);
  F(f[1], m, 1);
  F(f[2], m, 1);
  long long s1 = (x + y + z) % mod, s2 = (x + y - z) % mod,
            s3 = (x - y + z) % mod, s4 = (x - y - z) % mod;
  for (long long i = (0); i <= (m - 1); i++) {
    long long c1 = (n + f[0][i] + f[1][i] + f[2][i]) >> 2;
    ans[i] = ksm(s1, c1) * ksm(s2, (n + f[0][i] - c1 - c1) >> 1) % mod *
             ksm(s3, (n + f[1][i] - c1 - c1) >> 1) % mod *
             ksm(s4, (n + f[2][i] - c1 - c1) >> 1) % mod;
  }
  F(ans, m, -1);
  for (long long i = (0); i <= (m - 1); i++) printf("%lld ", upd(ans[i ^ p]));
  return 0;
}
