#include <bits/stdc++.h>
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x7fffffffffffffff;
const double eps = 1e-10;
unsigned int seed = 19260817;
const unsigned int _RAND_MAX_ = 4294967295u;
__inline__ __attribute__((always_inline)) unsigned int Rand() {
  return seed = seed * 998244353u + 1000000007u;
}
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) _Tp abs(const _Tp &a) {
  return a > 0 ? a : -a;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) _Tp max(const _Tp &a, const _Tp &b) {
  return a < b ? b : a;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) _Tp min(const _Tp &a, const _Tp &b) {
  return a < b ? a : b;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) void chmax(_Tp &a, const _Tp &b) {
  (a < b) && (a = b);
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) void chmin(_Tp &a, const _Tp &b) {
  (b < a) && (a = b);
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) bool _cmp(const _Tp &a,
                                                    const _Tp &b) {
  return abs(a - b) <= eps;
}
template <typename _Tp>
__inline__ __attribute__((always_inline)) void read(_Tp &x) {
  register char ch(getchar());
  bool f(false);
  while (ch < 48 || ch > 57) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (ch >= 48 && ch <= 57)
    x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  if (f) x = -x;
}
template <typename _Tp, typename... Args>
__inline__ __attribute__((always_inline)) void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
__inline__ __attribute__((always_inline)) int read_str(char *s) {
  register char ch(getchar());
  while (ch == ' ' || ch == '\r' || ch == '\n') ch = getchar();
  register char *tar = s;
  *tar = ch, ch = getchar();
  while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF)
    *(++tar) = ch, ch = getchar();
  return tar - s + 1;
}
const int N = (1 << 17) + 1;
const int mod = 998244353;
const long long inv2 = 499122177;
const long long inv4 = 748683265;
void FWT(int *a, int limit) {
  for (int len = 2; len <= limit; len <<= 1) {
    for (int pos = 0; pos < limit; pos += len) {
      for (int i = pos; i < pos + (len >> 1); ++i) {
        int tmp = a[i];
        a[i] = (tmp + a[i + (len >> 1)]) % mod;
        a[i + (len >> 1)] = (tmp - a[i + (len >> 1)] + mod) % mod;
      }
    }
  }
}
void IFWT(int *a, int limit) {
  for (int len = 2; len <= limit; len <<= 1) {
    for (int pos = 0; pos < limit; pos += len) {
      for (int i = pos; i < pos + (len >> 1); ++i) {
        int tmp = a[i];
        a[i] = inv2 * (tmp + a[i + (len >> 1)]) % mod;
        a[i + (len >> 1)] = inv2 * (tmp - a[i + (len >> 1)] + mod) % mod;
      }
    }
  }
}
int p[N], q[N], w[N];
int d[N];
long long ksm(long long a, int b = mod - 2) {
  a = (a % mod + mod) % mod;
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod, b >>= 1;
  }
  return res;
}
int main() {
  int n, m;
  read(n, m);
  m = 1 << m;
  int qwq = 0;
  int x, y, z;
  read(x, y, z);
  int a, b, c;
  for (int i = 1; i <= n; ++i) {
    read(a, b, c);
    qwq ^= a;
    b ^= a, c ^= a;
    ++p[b], ++q[c], ++w[b ^ c];
  }
  FWT(p, m);
  FWT(q, m);
  FWT(w, m);
  for (int i = 0; i < m; ++i) {
    int c1 = inv4 * ((long long)n + p[i] + q[i] + w[i]) % mod;
    int c2 = inv4 * ((long long)n + p[i] - q[i] - w[i] + (mod << 1)) % mod;
    int c3 = inv4 * ((long long)n - p[i] + q[i] - w[i] + (mod << 1)) % mod;
    int c4 = inv4 * ((long long)n - p[i] - q[i] + w[i] + (mod << 1)) % mod;
    d[i] = ksm((long long)x + y + z, c1) * ksm((long long)x + y - z, c2) % mod *
           ksm((long long)x - y + z, c3) % mod * ksm((long long)x - y - z, c4) %
           mod;
  }
  IFWT(d, m);
  for (int i = 0; i < m; ++i) printf("%d ", d[i ^ qwq]);
  printf("\n");
  return 0;
}
