#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &x) {
  x = 0;
  int f = 0;
  char c = getchar();
  while (c < '0' || c > '9') f |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  if (f) x = -x;
}
template <class T>
bool umax(T &x, T y) {
  return y > x ? x = y, 1 : 0;
}
template <class T>
bool umin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
const int mod = 998244353, inv2 = 499122177;
const int N = 1 << 18;
int n, k, A = 0;
long long x, y, z;
long long f1[N], f2[N], f3[N], g[N];
int qpow(int x, int y = mod - 2) {
  int res = 1;
  for (int i = 0; (y >> i) > 0; ++i, x = 1ll * x * x % mod)
    if (y >> i & 1) res = 1ll * res * x % mod;
  return res;
}
const int cxor[2][2] = {{1, 1}, {1, -1}};
const int ixor[2][2] = {{inv2, inv2}, {inv2, mod - inv2}};
void FWT(long long f[], int n, const int c[2][2]) {
  for (int l = 1; l < n; l = l + l)
    for (int i = 0; i < n; i += l + l)
      for (int j = i; j < i + l; ++j) {
        long long t = f[j];
        f[j] = (f[j] * c[0][0] + f[j + l] * c[0][1]) % mod;
        f[j + l] = (t * c[1][0] + f[j + l] * c[1][1]) % mod;
      }
}
int main() {
  read(n);
  read(k);
  read(x);
  read(y);
  read(z);
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  memset(f3, 0, sizeof(f3));
  for (int i = 1, a, b, c; i <= n; ++i) {
    read(a);
    read(b);
    read(c);
    A ^= a;
    b ^= a;
    c ^= a;
    f1[b]++;
    f2[c]++;
    f3[b ^ c]++;
  }
  FWT(f1, (1 << k), cxor);
  FWT(f2, (1 << k), cxor);
  FWT(f3, (1 << k), cxor);
  int w1 = (x + y + z) % mod, w2 = (x + y - z + mod) % mod;
  int w3 = (x - y + z + mod) % mod, w4 = (2ll * mod + x - y - z) % mod;
  for (int i = 0; i < (1 << k); ++i) {
    long long c1 = (f1[i] + n + f2[i] + f3[i]) / 4 % mod;
    long long c2 = (f1[i] + n - 2ll * c1) / 2 % mod;
    long long c3 = (f2[i] + n - 2ll * c1) / 2 % mod;
    long long c4 = (f3[i] + n - 2ll * c1) / 2 % mod;
    g[i] = 1ll * qpow(w1, c1) * qpow(w2, c2) % mod * qpow(w3, c3) % mod *
           qpow(w4, c4) % mod;
  }
  FWT(g, (1 << k), ixor);
  for (int i = 0; i < (1 << k); ++i) printf("%lld ", (g[i ^ A] + mod) % mod);
  puts("");
  return 0;
}
