#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "URDL";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
int x, y, z, a[140135], b[140135], c[140135], S;
int A[140135], P[4][140135], inv2;
inline void FWT_xor(int* A, const int fla, int lenth) {
  for (int i = 1; i < lenth; i <<= 1)
    for (int j = 0; j < lenth; j += (i << 1))
      for (int k = 0; k < i; k++) {
        long long x = A[j + k], y = A[j + k + i];
        A[j + k] = (x + y) % 998244353;
        A[j + k + i] = (x + 998244353 - y) % 998244353;
        if (fla == -1) {
          A[j + k] = (long long)A[j + k] * inv2 % 998244353;
          A[j + k + i] = (long long)A[j + k + i] * inv2 % 998244353;
        }
      }
}
void fmain(int tid) {
  inv2 = fastPow(2, 998244353 - 2);
  scanf("%d%d", &n, &k);
  scanf("%d%d%d", &x, &y, &z);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d%d%d", a + i, b + i, c + i);
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    S ^= a[i];
    b[i] ^= a[i];
    c[i] ^= a[i];
    a[i] = 0;
  }
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    P[1][b[i]]++;
    P[2][c[i]]++;
    P[3][b[i] ^ c[i]]++;
  }
  for (int(i) = 1; (i) <= (int)(3); (i)++) FWT_xor(P[i], 1, 1 << k);
  vector<int> C(4, 0);
  x %= 998244353;
  y %= 998244353;
  z %= 998244353;
  addmod(C[0], x);
  addmod(C[0], y);
  addmod(C[0], z);
  addmod(C[1], x);
  addmod(C[1], y);
  addmod(C[1], 998244353 - z);
  addmod(C[2], x);
  addmod(C[2], 998244353 - y);
  addmod(C[2], z);
  addmod(C[3], x);
  addmod(C[3], 998244353 - y);
  addmod(C[3], 998244353 - z);
  int i4 = fastPow(4, 998244353 - 2);
  for (int(i) = 0; (i) < (int)(1 << k); (i)++) {
    int c1 = ((long long)n + P[1][i] + P[2][i] + P[3][i]) * i4 % 998244353;
    int c2 = ((long long)n + P[1][i] - c1 * 2) * inv2 % 998244353;
    int c3 = ((long long)n + P[2][i] - c1 * 2) * inv2 % 998244353;
    int c4 = ((long long)n + P[3][i] - c1 * 2) * inv2 % 998244353;
    A[i] = fastPow(C[0], c1) * fastPow(C[1], c2) % 998244353 *
           fastPow(C[2], c3) % 998244353 * fastPow(C[3], c4) % 998244353;
  }
  FWT_xor(A, -1, 1 << k);
  for (int(i) = 0; (i) < (int)(1 << k); (i)++) {
    printf("%d ", A[i ^ S]);
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
