#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int X = 0;
  register char ch = 0;
  while (ch < 48 || ch > 57) ch = getchar();
  while (ch >= 48 && ch <= 57) X = X * 10 + (ch ^ 48), ch = getchar();
  return X;
}
long long powM(long long a, long long t = 998244353 - 2) {
  long long ans = 1;
  while (t) {
    if (t & 1) ans = ans * a % 998244353;
    a = a * a % 998244353;
    t >>= 1;
  }
  return ans;
}
int m;
long long x, y, z;
long long f1[140000], f2[140000], f3[140000], f[140000];
void DWT(long long *a) {
  for (int len = 1; len < m; len <<= 1)
    for (int p = 0; p < m; p += len + len)
      for (int i = p; i < p + len; i++) {
        long long sav0 = a[i];
        a[i] += a[i + len];
        a[i + len] = sav0 - a[i + len];
      }
}
void IDWT(long long *a) {
  for (int len = 1; len < m; len <<= 1)
    for (int p = 0; p < m; p += len + len)
      for (int i = p; i < p + len; i++) {
        long long sav0 = a[i];
        a[i] = (a[i] + a[i + len]) * 499122177ll % 998244353;
        a[i + len] = (sav0 - a[i + len]) * 499122177ll % 998244353;
      }
}
int n;
int main() {
  n = read();
  m = (1 << read());
  x = read();
  y = read();
  z = read();
  int sav = 0;
  for (int i = 0, a, b, c; i < n; i++) {
    a = read();
    b = read();
    c = read();
    sav ^= a;
    b ^= a;
    c ^= a;
    f1[b]++;
    f2[c]++;
    f3[b ^ c]++;
  }
  DWT(f1);
  DWT(f2);
  DWT(f3);
  long long s1 = (x + y + z) % 998244353, s2 = (x + y - z) % 998244353,
            s3 = (x - y + z) % 998244353, s4 = (x - y - z) % 998244353;
  for (int i = 0; i < m; i++) {
    long long c1 = (n + f1[i] + f2[i] + f3[i]) / 4;
    f[i] = powM(s1, c1) * powM(s2, (n + f1[i] - c1 - c1) / 2) % 998244353 *
           powM(s3, (n + f2[i] - c1 - c1) / 2) % 998244353 *
           powM(s4, (n + f3[i] - c1 - c1) / 2) % 998244353;
  }
  IDWT(f);
  for (int i = 0; i < m; i++)
    printf("%lld ", (f[i ^ sav] + 998244353) % 998244353);
  return 0;
}
