#include <bits/stdc++.h>
using namespace std;
const int N = 140005, P = 998244353, INV2 = (P + 1) / 2;
using ll = long long;
ll x, y, z, f1[N], f2[N], f3[N], f[N];
ll qpow(ll a, ll b = P - 2) {
  ll ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % P;
    a = a * a % P;
    b >>= 1;
  }
  return ret;
}
void FWT_xor(ll a[], int n, int fl) {
  for (int l = 1; l < n; l *= 2)
    for (int s = 0; s < n; s += l * 2)
      for (int k = s; k < s + l; k++) {
        ll tmp = a[k + l];
        a[k + l] = (a[k] - tmp) % P * (fl == 1 ? 1 : INV2) % P;
        a[k] = (a[k] + tmp) % P * (fl == 1 ? 1 : INV2) % P;
      }
}
int n, m;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  cin >> m;
  m = 1 << m;
  int tt = 0;
  cin >> x >> y >> z;
  for (int i = 0, a, b, c; i < n; i++) {
    cin >> a >> b >> c;
    tt ^= a;
    b ^= a;
    c ^= a;
    f1[b]++;
    f2[c]++;
    f3[b ^ c]++;
  }
  FWT_xor(f1, m, 1);
  FWT_xor(f2, m, 1);
  FWT_xor(f3, m, 1);
  ll s1 = (x + y + z) % P, s2 = (x + y - z) % P, s3 = (x - y + z) % P,
     s4 = (x - y - z) % P;
  for (int i = 0; i < m; i++) {
    ll c1 = (n + f1[i] + f2[i] + f3[i]) / 4;
    f[i] = qpow(s1, c1) * qpow(s2, (n + f1[i] - c1 - c1) / 2) % P *
           qpow(s3, (n + f2[i] - c1 - c1) / 2) % P *
           qpow(s4, (n + f3[i] - c1 - c1) / 2) % P;
  }
  FWT_xor(f, m, -1);
  for (int i = 0; i < m; i++) cout << (f[i ^ tt] + P) % P << ' ';
  return 0;
}
