#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long qpow(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long A[1000005], B[1000005], C[1000005], D[1000005];
int n, k;
long long x, y, z;
void fwt(long long f[], int k) {
  if (k == 0) return;
  for (int i = 0; i < (1 << (k - 1)); i++) {
    long long a = f[i] + f[i + (1 << (k - 1))],
              b = f[i] - f[i + (1 << (k - 1))];
    a %= mod;
    b %= mod;
    f[i] = a, f[i + (1 << (k - 1))] = b;
  }
  fwt(f, k - 1);
  fwt(f + (1 << (k - 1)), k - 1);
}
int main() {
  scanf("%d%d", &n, &k);
  int w = 0;
  scanf("%lld%lld%lld", &x, &y, &z);
  for (int i = 1; i <= n; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    b ^= a;
    c ^= a;
    w ^= a;
    B[b]++;
    C[c]++;
    A[b ^ c]++;
  }
  fwt(A, k);
  fwt(B, k);
  fwt(C, k);
  for (int i = 0; i < (1 << k); i++) {
    int a, b, c, d;
    d = (n + A[i]) / 2;
    b = (n + B[i]) / 2;
    c = (n + C[i]) / 2;
    a = (b + c + d - n) / 2;
    d -= a;
    b -= a;
    c -= a;
    D[i] = qpow((x + y + z) % mod, a) * qpow((x + y - z + mod) % mod, b) % mod *
           qpow((x - y + z + mod) % mod, c) % mod *
           qpow((x - y - z + 2 * mod) % mod, d) % mod;
  }
  fwt(D, k);
  for (int i = 0; i < (1 << k); i++) {
    long long d = D[i ^ w];
    if (d < 0) d += mod;
    printf("%lld ", d * qpow(qpow(2, mod - 2), k) % mod);
  }
}
