#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char c = getchar();
  long long x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
struct modint {
  long long x;
  modint(long long o = 0) { x = o; }
  modint &operator=(long long o) { return x = o, *this; }
  modint &operator+=(modint o) {
    return x = x + o.x >= 998244353 ? x + o.x - 998244353 : x + o.x, *this;
  }
  modint &operator-=(modint o) {
    return x = x - o.x < 0 ? x - o.x + 998244353 : x - o.x, *this;
  }
  modint &operator*=(modint o) { return x = 1ll * x * o.x % 998244353, *this; }
  modint &operator^=(long long b) {
    modint a = *this, c = 1;
    for (; b; b >>= 1, a *= a)
      if (b & 1) c *= a;
    return x = c.x, *this;
  }
  modint &operator/=(modint o) { return *this *= o ^= 998244353 - 2; }
  modint &operator+=(long long o) {
    return x = x + o >= 998244353 ? x + o - 998244353 : x + o, *this;
  }
  modint &operator-=(long long o) {
    return x = x - o < 0 ? x - o + 998244353 : x - o, *this;
  }
  modint &operator*=(long long o) { return x = 1ll * x * o % 998244353, *this; }
  modint &operator/=(long long o) {
    return *this *= ((modint(o)) ^= 998244353 - 2);
  }
  template <class I>
  friend modint operator+(modint a, I b) {
    return a += b;
  }
  template <class I>
  friend modint operator-(modint a, I b) {
    return a -= b;
  }
  template <class I>
  friend modint operator*(modint a, I b) {
    return a *= b;
  }
  template <class I>
  friend modint operator/(modint a, I b) {
    return a /= b;
  }
  friend modint operator^(modint a, long long b) { return a ^= b; }
  friend bool operator==(modint a, long long b) { return a.x == b; }
  friend bool operator!=(modint a, long long b) { return a.x != b; }
  bool operator!() { return !x; }
  modint operator-() { return x ? 998244353 - x : 0; }
};
inline modint qpow(modint a, modint b) { return (a ^ b.x); }
inline void fwtxor(modint *f, long long n, long long x) {
  for (long long l = 2, k = 1; l <= n; l <<= 1, k <<= 1)
    for (long long i = 0; i < n; i += l)
      for (long long j = 0; j < k; ++j) {
        modint a = f[i + j], b = f[i + j + k];
        f[i + j] = (a + b) * x, f[i + j + k] = (a - b) * x;
      }
}
long long n, k, all_a;
modint x, y, z, v1, v2, v3, v4;
long long b[100005], c[100005];
modint A[1 << 17], B[1 << 17], C[1 << 17], D[1 << 17], f[1 << 17];
signed main() {
  n = read(), k = 1 << read(), x = read(), y = read(), z = read();
  v1 = x + y + z, v2 = x + y - z, v3 = x - y + z, v4 = x - y - z;
  for (register long long i = (1); i <= (n); ++i) {
    long long a = read();
    all_a ^= a;
    b[i] = read() ^ a, c[i] = read() ^ a;
    B[b[i]] += 1, C[c[i]] += 1, D[b[i] ^ c[i]] += 1;
  }
  fwtxor(B, k, 1), fwtxor(C, k, 1), fwtxor(D, k, 1);
  modint inv4 = modint(1) / 4;
  for (register long long i = (0); i <= (k - 1); ++i) {
    A[i] = n, f[i] = 1;
    f[i] *= qpow(v1, (A[i] + B[i] + C[i] + D[i]) * inv4);
    f[i] *= qpow(v2, (A[i] + B[i] - C[i] - D[i]) * inv4);
    f[i] *= qpow(v3, (A[i] - B[i] + C[i] - D[i]) * inv4);
    f[i] *= qpow(v4, (A[i] - B[i] - C[i] + D[i]) * inv4);
  }
  fwtxor(f, k, 499122177);
  for (register long long i = (0); i <= (k - 1); ++i)
    printf("%d ", f[i ^ all_a]);
  return 0;
}
