#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int ksm(int a, int b = mod - 2) {
  int ret = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) ret = 1ll * ret * a % mod;
  return ret;
}
int inv2 = ksm(2);
void FWT(int *A, int n) {
  for (int mid = 1; mid < n; mid *= 2)
    for (int i = 0; i < n; i += mid * 2)
      for (int j = 0; j < mid; j++) {
        int x = A[i + j] + A[i + j + mid], y = A[i + j] - A[i + j + mid];
        A[i + j] = x;
        A[i + j + mid] = y;
      }
}
void IFWT(int *A, int n) {
  for (int mid = 1; mid < n; mid *= 2)
    for (int i = 0; i < n; i += mid * 2)
      for (int j = 0; j < mid; j++) {
        int x = 1ll * (A[i + j + mid] + A[i + j]) * inv2 % mod,
            y = 1ll * (A[i + j] - A[i + j + mid]) * inv2 % mod;
        A[i + j] = x;
        A[i + j + mid] = y;
      }
}
int n, m;
const int N = (1 << 17) + 20;
int c[3], a[N][3];
int bit[8], g[8][N], ans[N];
const int jz[8][8] = {{873463809, -873463809, -873463809, 873463809, -873463809,
                       873463809, 873463809, -873463809},
                      {873463809, 873463809, -873463809, -873463809, -873463809,
                       -873463809, 873463809, 873463809},
                      {873463809, -873463809, 873463809, -873463809, -873463809,
                       873463809, -873463809, 873463809},
                      {873463809, 873463809, 873463809, 873463809, -873463809,
                       -873463809, -873463809, -873463809},
                      {873463809, -873463809, -873463809, 873463809, 873463809,
                       -873463809, -873463809, 873463809},
                      {873463809, 873463809, -873463809, -873463809, 873463809,
                       873463809, -873463809, -873463809},
                      {873463809, -873463809, 873463809, -873463809, 873463809,
                       -873463809, 873463809, -873463809},
                      {873463809, 873463809, 873463809, 873463809, 873463809,
                       873463809, 873463809, 873463809}};
int main() {
  scanf("%d%d", &n, &m);
  m = 1 << m;
  scanf("%d%d%d", &c[0], &c[1], &c[2]);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
    for (int j = 1; j < 8; j++) {
      int h = 0;
      for (int k = 0; k < 3; k++)
        if ((j >> k) & 1) h ^= a[i][k];
      g[j][h]++;
    }
  }
  for (int j = 1; j < 8; j++) bit[j] = bit[j - (j & (-j))] + 1;
  for (int j = 1; j < 8; j++) FWT(g[j], m);
  static int h[8];
  for (int j = 0; j < 8; j++) {
    h[j] = 0;
    for (int k = 0; k < 3; k++)
      if ((j >> k) & 1)
        h[j] = (h[j] + c[k]) % mod;
      else
        h[j] = (h[j] - c[k]) % mod;
  }
  static int K[9];
  for (int i = 0; i < m; i++) {
    g[0][i] = n;
    memset(K, 0, sizeof K);
    for (int j = 0; j < 8; j++)
      for (int l = 0; l < 8; l++)
        K[l] = (K[l] + 1ll * jz[l][j] * g[j][i]) % mod;
    ans[i] = 1;
    for (int j = 0; j < 8; j++)
      K[j] = (K[j] + mod) % mod, ans[i] = 1ll * ans[i] * ksm(h[j], K[j]) % mod;
  }
  IFWT(ans, m);
  for (int i = 0; i < m; i++) printf("%d ", (ans[i] + mod) % mod);
  return 0;
}
