#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
inline int add(int a, int b) {
  if ((a += b) >= mod) a -= mod;
  return a;
}
inline int dec(int a, int b) {
  if ((a -= b) < 0) a += mod;
  return a;
}
inline int mult(int a, int b) {
  long long t = 1ll * a * b;
  if (t >= mod) t %= mod;
  return t;
}
inline int power(int a, int b) {
  int out = 1;
  while (b) {
    if (b & 1) out = mult(out, a);
    a = mult(a, a);
    b >>= 1;
  }
  return out;
}
int n, K, x, y, z, a[100010], b[100010], c[100010], ans[1 << 17];
inline void DWT(int* A) {
  for (int i = 1; i < (1 << K); i <<= 1) {
    for (int j = 0; j < (1 << K); j += (i << 1)) {
      for (int k = 0; k < i; k++) {
        int tx = A[j + k], ty = A[i + j + k];
        A[j + k] = add(tx, ty), A[i + j + k] = dec(tx, ty);
      }
    }
  }
}
int f1[1 << 17], f2[1 << 17], f3[1 << 17];
int main() {
  scanf("%d%d", &n, &K);
  scanf("%d%d%d", &x, &y, &z);
  x %= mod;
  y %= mod;
  z %= mod;
  int s = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d", &a[i], &b[i], &c[i]);
    s ^= a[i];
    b[i] ^= a[i];
    c[i] ^= a[i];
    f1[b[i]]++;
    f2[c[i]]++;
    f3[b[i] ^ c[i]]++;
  }
  DWT(f1);
  DWT(f2);
  DWT(f3);
  int v[4];
  v[0] = add(add(x, y), z);
  v[1] = add(add(x, y), dec(0, z));
  v[2] = add(dec(x, y), z);
  v[3] = add(dec(x, y), dec(0, z));
  const int iv4 = 748683265, iv2 = (mod + 1) / 2;
  for (int i = 0; i < (1 << K); i++) {
    int c[4];
    c[0] = mult(add(add(n, f1[i]), add(f2[i], f3[i])), iv4);
    c[1] = mult(add(dec(n, add(c[0], c[0])), f1[i]), iv2);
    c[2] = mult(add(dec(n, add(c[0], c[0])), f2[i]), iv2);
    c[3] = mult(add(dec(n, add(c[0], c[0])), f3[i]), iv2);
    ans[i] = 1;
    for (int j = 0; j < 4; j++) ans[i] = mult(ans[i], power(v[j], c[j]));
  }
  DWT(ans);
  int pw = power(iv2, K);
  for (int i = 0; i < (1 << K); i++) printf("%d ", mult(ans[i ^ s], pw));
  return 0;
}
