#include <bits/stdc++.h>
using namespace std;
long long n, k, x, y, z, A[(1 << 17)], B[(1 << 17)], C[(1 << 17)],
    mmp[(1 << 17)], Comb[18][18];
long long O[(1 << 17)], Ans[4][(1 << 17)];
long long powmod(long long x, long long y = 998244353 - 2,
                 long long p = 998244353) {
  x %= p;
  y = (y % (p - 1) + (p - 1)) % (p - 1);
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % p;
    x = x * x % p;
    y >>= 1;
  }
  return ans;
}
signed main() {
  scanf("%lld%lld%lld%lld%lld", &n, &k, &x, &y, &z);
  for (long long i = 0; i < n; i++) {
    scanf("%lld%lld%lld", &A[i], &B[i], &C[i]);
    B[i] ^= A[i];
    C[i] ^= A[i];
  }
  for (long long i = 0; i <= k; i++)
    for (long long j = 0; j <= i; j++)
      Comb[i][j] = !j ? 1 : Comb[i - 1][j - 1] + Comb[i - 1][j];
  mmp[0] = 1;
  for (long long i = 1; i <= k; i++) {
    mmp[i] = 1 - (i % 2);
    for (long long j = 0; j < i; j++) mmp[i] -= Comb[i][j] * mmp[j];
  }
  for (long long b1 = 0; b1 < 2; b1++)
    for (long long b2 = 0; b2 < 2; b2++) {
      memset(O, 0, sizeof O);
      for (long long i = 0; i < n; i++) O[(B[i] * b1) ^ (C[i] * b2)]++;
      for (long long i = 1; i < (1 << k); i *= 2)
        for (long long j = 0; j < (1 << k); j += i + i)
          for (long long k = j; k < j + i; k++)
            O[k] = (O[k] + O[k + i]) % (998244353 - 1);
      for (long long i = 0; i < (1 << k); i++)
        O[i] *= mmp[__builtin_popcount(i)], O[i] %= (998244353 - 1);
      for (long long i = 1; i < (1 << k); i *= 2)
        for (long long j = 0; j < (1 << k); j += i + i)
          for (long long k = j; k < j + i; k++)
            O[k + i] = (O[k + i] + O[k]) % (998244353 - 1);
      memcpy(Ans[b1 * 2 + b2], O, sizeof O);
    }
  for (long long i = 0; i < (1 << k); i++) {
    long long _00 = Ans[0][i], _01 = Ans[1][i], _10 = Ans[2][i],
              _11 = Ans[3][i];
    long long __00 = (_01 + _10 + _11 - _00) / 2;
    long long __11 = _11 - __00;
    long long __01 = _10 - __00;
    long long __10 = _01 - __00;
    O[i] = powmod(x - y - z, __11) * powmod(x - y + z, __10) % 998244353 *
           powmod(x + y - z, __01) % 998244353 * powmod(x + y + z, __00) %
           998244353;
  }
  long long tot = 0;
  for (long long i = 0; i < n; i++) tot ^= A[i];
  for (long long i = 1; i < (1 << k); i *= 2)
    for (long long j = 0; j < (1 << k); j += i + i)
      for (long long k = j; k < j + i; k++) {
        long long A = O[k], B = O[k + i];
        O[k] = (A + B) % 998244353;
        O[k + i] = (A - B) % 998244353;
      }
  for (long long i = 0; i < (1 << k); i++)
    printf("%lld ",
           (O[i ^ tot] * powmod(1 << k) % 998244353 + 998244353) % 998244353);
  return 0;
}
