#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353, inv2 = mod - mod / 2, inv4 = mod - mod / 4,
          N = 1 << 17;
int n, k, x, y, z;
int suma, b[N], c[N];
inline int read() {
  int x = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') f |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar();
  return f ? -x : x;
}
int power(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = (long long)x * x % mod)
    if (y & 1) res = (long long)res * x % mod;
  return res;
}
void fwt(int* a, int lim, int type) {
  for (int mid = 1; mid < lim; mid <<= 1)
    for (int j = 0; j < lim; j += (mid << 1))
      for (int k = 0; k < mid; ++k) {
        int x = a[j + k], y = a[j + k + mid];
        if (type)
          a[j + k] = (x + y) % mod, a[j + k + mid] = (x - y + mod) % mod;
        else
          a[j + k] = (long long)inv2 * (x + y) % mod,
                a[j + k + mid] = (long long)inv2 * (x - y + mod) % mod;
      }
}
int p1[N], p2[N], p3[N], s[N];
int main() {
  n = read(), k = read();
  x = read(), y = read(), z = read();
  for (int i = 1, a; i <= n; ++i) {
    suma ^= (a = read());
    p1[b[i] = (read() ^ a)]++;
    p2[c[i] = (read() ^ a)]++;
    p3[b[i] ^ c[i]]++;
  }
  fwt(p1, 1 << k, 1);
  fwt(p2, 1 << k, 1);
  fwt(p3, 1 << k, 1);
  int a1 = (x + y + (long long)(z)) % mod;
  int a2 = (x + y - (long long)(z) + mod) % mod;
  int a3 = (x - y + (long long)(z) + mod) % mod;
  int a4 = (x - y - (long long)(z) + 2 * mod) % mod;
  for (int i = 0; i < (1 << k); ++i) {
    int c1 = (n + (long long)p1[i] + p2[i] + p3[i]) * inv4 % mod;
    int c2 = (n + p1[i] - 2LL * c1 + 2 * mod) * inv2 % mod;
    int c3 = (n + p2[i] - 2LL * c1 + 2 * mod) * inv2 % mod;
    int c4 = (n + p3[i] - 2LL * c1 + 2 * mod) * inv2 % mod;
    s[i] = (long long)power(a1, c1) * power(a2, c2) % mod * power(a3, c3) %
           mod * power(a4, c4) % mod;
  }
  fwt(s, 1 << k, 0);
  for (int i = 0; i < (1 << k); ++i) printf("%d ", s[i ^ suma]);
}
