#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, inv2 = (mod + 1) / 2;
const int N = (1 << 24);
int n, m, X, Y, Z, mu, v1, v2, v3, v4, inv;
vector<int> a, b, c, ans;
inline int add(const int &x, const int &y) {
  return x + y < mod ? x + y : x + y - mod;
}
inline int sub(const int &x, const int &y) {
  return x - y < 0 ? x - y + mod : x - y;
}
inline int mul(const int &x, const int &y) {
  return (int)((long long)x * y % mod);
}
int ksm(int x, int y = mod - 2) {
  int ss = 1;
  for (; y; y >>= 1, x = mul(x, x))
    if (y & 1) ss = mul(ss, x);
  return ss;
}
void fwt(vector<int> &A, int lmt, int opt) {
  A.resize(lmt);
  for (int mid = 1; mid < lmt; mid <<= 1)
    for (int j = 0; j < lmt; j += mid << 1)
      for (int k = 0; k < mid; k++) {
        int x = A[j + k], y = A[j + mid + k];
        A[j + k] = add(x, y), A[j + mid + k] = sub(x, y);
        if (opt == -1) {
          A[j + k] = mul(A[j + k], inv2);
          A[j + mid + k] = mul(A[j + mid + k], inv2);
        }
      }
}
int main() {
  scanf("%d%d", &n, &m), m = 1 << m, inv = ksm(4);
  a.resize(m), b.resize(m), c.resize(m), ans.resize(m);
  scanf("%d%d%d", &X, &Y, &Z);
  for (int i = 1, x, y, z; i <= n; i++) {
    scanf("%d%d%d", &x, &y, &z), mu ^= x;
    ++a[x ^ y], ++b[x ^ z], ++c[y ^ z];
  }
  fwt(a, m, 1), fwt(b, m, 1), fwt(c, m, 1);
  v1 = add(X, add(Y, Z)), v2 = add(X, sub(Y, Z));
  v3 = add(X, sub(Z, Y)), v4 = sub(X, add(Z, Y));
  for (int i = 0; i < m; i++) {
    int x1 = ksm(
        v1, ((long long)n + a[i] + b[i] + c[i] + 4ll * mod) % mod * inv % mod);
    int x2 = ksm(
        v2, ((long long)n + a[i] - b[i] - c[i] + 4ll * mod) % mod * inv % mod);
    int x3 = ksm(
        v3, ((long long)n - a[i] + b[i] - c[i] + 4ll * mod) % mod * inv % mod);
    int x4 = ksm(
        v4, ((long long)n - a[i] - b[i] + c[i] + 4ll * mod) % mod * inv % mod);
    ans[i] = mul(x1, mul(x2, mul(x3, x4)));
  }
  fwt(ans, m, -1);
  for (int i = 0; i < m; i++) printf("%d ", ans[i ^ mu]);
  return 0;
}
