#include <bits/stdc++.h>
using namespace std;
inline int inc(int a, int b) {
  return a + b < 998244353 ? a + b : a + b - 998244353;
}
inline int dec(int a, int b) { return a < b ? a - b + 998244353 : a - b; }
inline int mul(int a, int b) { return (int)((long long int)a * b % 998244353); }
inline int pow(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
inline int inv(int x) { return pow(x, 998244353 - 2); }
int n, k, X, Y, Z;
int A[100000], B[100000], C[100000];
int p1[1 << 17], p2[1 << 17], p3[1 << 17];
int ans[1 << 17];
void DWT(int* F) {
  for (int i = 1; i < (1 << k); i <<= 1)
    for (int j = 0; j < (1 << k); j += i + i)
      for (int c = j; c < j + i; c++) {
        int x = F[c], y = F[c + i];
        F[c] = x + y;
        F[c + i] = x - y;
      }
  return;
}
void IDWT(int* F) {
  for (int i = 1; i < (1 << k); i <<= 1)
    for (int j = 0; j < (1 << k); j += i + i)
      for (int c = j; c < j + i; c++) {
        int x = F[c], y = F[c + i];
        F[c] = mul(inc(x, y), (998244353 + 1) >> 1);
        F[c + i] = mul(dec(x, y), (998244353 + 1) >> 1);
      }
  return;
}
int main(void) {
  scanf("%d%d%d%d%d", &n, &k, &X, &Y, &Z);
  int all = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d", &A[i], &B[i], &C[i]);
    B[i] ^= A[i];
    C[i] ^= A[i];
    all ^= A[i];
    p1[B[i]]++;
    p2[C[i]]++;
    p3[B[i] ^ C[i]]++;
  }
  DWT(p1);
  DWT(p2);
  DWT(p3);
  int s0 = inc(X, inc(Y, Z));
  int s1 = inc(X, inc(Y, 998244353 - Z));
  int s2 = inc(X, inc(998244353 - Y, Z));
  int s3 = inc(X, inc(998244353 - Y, 998244353 - Z));
  for (int i = 0; i < (1 << k); i++) {
    int c0 = (n + p1[i] + p2[i] + p3[i]) / 4;
    int c1 = (n + p1[i] - c0 - c0) / 2;
    int c2 = (n + p2[i] - c0 - c0) / 2;
    int c3 = (n + p3[i] - c0 - c0) / 2;
    ans[i] = mul(pow(s0, c0), pow(s1, c1));
    ans[i] = mul(ans[i], mul(pow(s2, c2), pow(s3, c3)));
  }
  IDWT(ans);
  for (int i = 0; i < (1 << k); i++)
    printf("%d%c", ans[i ^ all], i == (i << k) - 1 ? '\n' : ' ');
  return 0;
}
