#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, S = (1 << 17) + 5, Mo = 998244353, inv = (Mo + 1) / 3;
int pwr(int x, int y) {
  int z = 1;
  for (; y; y >>= 1, x = (long long)x * x % Mo)
    if (y & 1) z = (long long)z * x % Mo;
  return z;
}
void inc(int &x, int y) { x = x + y >= Mo ? x + y - Mo : x + y; }
void dec(int &x, int y) { x = x - y < 0 ? x - y + Mo : x - y; }
void FWT(int *a, int len) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; k++) {
        int u = a[j + k], v = a[j + k + i];
        a[j + k] = (u + v) % Mo;
        a[j + k + i] = (u - v + Mo) % Mo;
      }
}
int n, m, x[3], p[N][3], f[4][S], g[4], h[S], v[4];
int main() {
  scanf("%d%d", &n, &m);
  scanf("%d%d%d", &x[0], &x[1], &x[2]);
  for (int s = 0; s <= 3; s++) {
    v[s] = x[0];
    for (int i = 1; i <= 2; i++)
      if (s >> (i - 1) & 1)
        dec(v[s], x[i]);
      else
        inc(v[s], x[i]);
  }
  int ss = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= 2; j++) scanf("%d", &p[i][j]);
    for (int j = 1; j <= 2; j++) p[i][j] ^= p[i][0];
    ss ^= p[i][0];
  }
  for (int s = 1; s <= 3; s++) {
    for (int i = 1; i <= n; i++) {
      int x = 0;
      for (int j = 1; j <= 2; j++)
        if (s >> (j - 1) & 1) x ^= p[i][j];
      f[s][x]++;
    }
    FWT(f[s], 1 << m);
  }
  int inv = pwr(4, Mo - 2);
  for (int i = 0; i <= (1 << m) - 1; i++) {
    for (int s = 1; s <= 3; s++) g[s] = f[s][i];
    g[0] = n;
    FWT(g, 4);
    for (int s = 0; s <= 3; s++) g[s] = (long long)g[s] * inv % Mo;
    h[i] = 1;
    for (int s = 0; s <= 3; s++) h[i] = (long long)h[i] * pwr(v[s], g[s]) % Mo;
  }
  FWT(h, 1 << m);
  inv = pwr(1 << m, Mo - 2);
  for (int i = 0; i <= (1 << m) - 1; i++)
    printf("%d ", (long long)h[i ^ ss] * inv % Mo);
  return 0;
}
