#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 998244353;
const int N = 200005;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  string s = "/home/jslijin/jslijin/code/";
  freopen((s + "code.in").c_str(), "r", stdin);
  freopen((s + "code.out").c_str(), "w", stdout);
}
int ab[N], ac[N], bc[N], ret[N], n, m, a, b, c, x, y, z, A, B, C, D, k,
    X = 0, v[5], rev = _p + 1 >> 1;
int mul(int x, int y) { return (long long)x * y % _p; }
int Pow(int x, int k) {
  int ret = 1;
  for (; k; k >>= 1, x = mul(x, x))
    if (k & 1) ret = mul(ret, x);
  return ret;
}
void solve(int a, int b, int c, int d) {
  A = a + b + c + d >> 2, B = a + b - c - d >> 2, C = a - b + c - d >> 2,
  D = a - b - c + d >> 2;
}
void FWT(int a[], int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        int x = a[i + j], y = a[i + j + d];
        a[i + j] = x + y, a[i + j + d] = x - y;
      }
}
void UFWT(int a[], int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        int x = a[i + j], y = a[i + j + d];
        a[i + j] = 1LL * (x + y) * rev % _p,
              a[i + j + d] = (1LL * (x - y) * rev % _p + _p) % _p;
      }
}
int main() {
  scanf("%d%d%d%d%d", &n, &k, &x, &y, &z), m = 1 << k;
  v[1] = ((long long)x + y + z) % _p, v[2] = ((long long)x + y - z) % _p,
  v[3] = ((long long)x - y + z) % _p, v[4] = ((long long)x - y - z) % _p;
  for (int i = (1); i <= (n); ++i)
    scanf("%d%d%d", &a, &b, &c), ab[a ^ b]++, ac[a ^ c]++, bc[b ^ c]++, X ^= a;
  FWT(ab, m), FWT(ac, m), FWT(bc, m);
  for (int i = (0); i <= (m - 1); ++i)
    solve(n, ab[i], ac[i], bc[i]),
        ret[i] = mul(mul(Pow(v[1], A), Pow(v[2], B)),
                     mul(Pow(v[3], C), Pow(v[4], D)));
  UFWT(ret, m);
  for (int i = (0); i <= (m - 1); ++i) printf("%d ", (ret[i ^ X] + _p) % _p);
  printf("\n");
  return 0;
}
