#include <bits/stdc++.h>
using namespace std;
const int maxn = 1.5e5 + 10;
const int mod = 998244353;
int n, N;
int x, y, z;
int a[maxn], b[maxn], c[maxn];
inline int Read() {
  register int ch, a;
  while (ch = getchar(), ch < '0' || ch > '9')
    ;
  a = (ch ^ 48);
  while (ch = getchar(), ch >= '0' && ch <= '9') a = a * 10 + (ch ^ 48);
  return a;
}
inline int Pow(int a, int n) {
  int ans = 1;
  for (; n; n >>= 1, a = a * 1ll * a % mod)
    if (n & 1) ans = ans * 1ll * a % mod;
  return ans;
}
int A[maxn];
int f[maxn][5][5];
inline void FWT(int *A) {
  for (int i = 1; i < N; i <<= 1) {
    for (int step = i << 1, j = 0; j < N; j += step) {
      for (int k = 0; k < i; k++) {
        int x = A[j + k], y = A[j + k + i];
        A[j + k] = ((x + y >= mod) ? (x + y - mod) : (x + y)),
              A[j + k + i] = ((x - y < 0) ? (x - y + mod) : (x - y));
      }
    }
  }
}
inline void IFWT(int *A) {
  for (int i = 1; i < N; i <<= 1) {
    for (int step = i << 1, j = 0; j < N; j += step) {
      for (int k = 0; k < i; k++) {
        int x = A[j + k], y = A[j + k + i];
        A[j + k] = ((x + y >= mod) ? (x + y - mod) : (x + y)),
              A[j + k + i] = ((x - y < 0) ? (x - y + mod) : (x - y));
      }
    }
  }
  int Inv = Pow(N, mod - 2);
  for (int i = 0; i < N; i++) A[i] = A[i] * 1ll * Inv % mod;
}
inline void Gauss(int f[5][5]) {
  for (int i = 0; i < 4; i++) {
    int p = i;
    for (int j = i; j < 4; j++)
      if (f[j][i]) {
        p = j;
        break;
      }
    if (p ^ i)
      for (int j = 0; j < 5; j++) swap(f[i][j], f[p][j]);
    assert(f[i][i]);
    for (int j = 0; j < 4; j++)
      if ((i ^ j) && f[j][i]) {
        int Rate = f[j][i] * 1ll * Pow(f[i][i], mod - 2) % mod;
        for (int k = 0; k < 5; k++)
          f[j][k] = (f[j][k] - f[i][k] * 1ll * Rate % mod + mod) % mod;
      }
  }
}
int Ans[maxn];
int main() {
  n = Read(), N = 1 << Read();
  x = Read(), y = Read(), z = Read();
  int Bas = 0;
  for (int i = 1; i <= n; i++) {
    a[i] = Read(), b[i] = Read(), c[i] = Read();
    Bas ^= a[i], b[i] ^= a[i], c[i] ^= a[i], a[i] = 0;
  }
  for (int i = 0; i < N; i++)
    f[i][0][0] = 1, f[i][0][1] = 1, f[i][0][2] = 1, f[i][0][3] = 1,
    f[i][0][4] = n;
  for (int i = 1; i <= n; i++) ++A[b[i]];
  FWT(A);
  for (int i = 0; i < N; i++)
    f[i][1][0] = 1, f[i][1][1] = 1, f[i][1][2] = mod - 1, f[i][1][3] = mod - 1,
    f[i][1][4] = A[i];
  memset(A, 0, N << 2);
  for (int i = 1; i <= n; i++) ++A[c[i]];
  FWT(A);
  for (int i = 0; i < N; i++)
    f[i][2][0] = 1, f[i][2][1] = mod - 1, f[i][2][2] = 1, f[i][2][3] = mod - 1,
    f[i][2][4] = A[i];
  memset(A, 0, N << 2);
  for (int i = 1; i <= n; i++) ++A[c[i] ^ b[i]];
  FWT(A);
  for (int i = 0; i < N; i++)
    f[i][3][0] = 1, f[i][3][1] = mod - 1, f[i][3][2] = mod - 1, f[i][3][3] = 1,
    f[i][3][4] = A[i];
  memset(A, 0, N << 2);
  int k1 = ((x + y) % mod + z) % mod, k2 = ((x + y) % mod - z + mod) % mod,
      k3 = ((x - y + mod) % mod + z) % mod,
      k4 = ((x - y + mod) % mod - z + mod) % mod;
  for (int i = 0; i < N; i++) {
    Gauss(f[i]);
    int tmp = 1;
    tmp = tmp * 1ll *
          Pow(k1, f[i][0][4] * 1ll * Pow(f[i][0][0], mod - 2) % mod) % mod;
    tmp = tmp * 1ll *
          Pow(k2, f[i][1][4] * 1ll * Pow(f[i][1][1], mod - 2) % mod) % mod;
    tmp = tmp * 1ll *
          Pow(k3, f[i][2][4] * 1ll * Pow(f[i][2][2], mod - 2) % mod) % mod;
    tmp = tmp * 1ll *
          Pow(k4, f[i][3][4] * 1ll * Pow(f[i][3][3], mod - 2) % mod) % mod;
    A[i] = tmp;
  }
  IFWT(A);
  for (int i = 0; i < N; i++) (Ans[i ^ Bas] += A[i]) %= mod;
  for (int i = 0; i < N; i++) printf("%d ", Ans[i]);
  puts("");
  return 0;
}
