#include #include using mint = atcoder::modint998244353; template void bitwise_transform(std::vector &a, F f) { const int n = a.size(); for (int w = 1; w < n; w *= 2) { for (int i = 0; i < n; i += w * 2) { for (int k = 0; k < w; k++) { f(a[i + k], a[i + w + k]); } } } } int main() { int N, M; std::cin >> N >> M; std::vector L(M), R(M); for (int i = 0; i < M; i++) { std::cin >> L[i] >> R[i]; } std::vector ans(1 << N); for (int p = 0; p < N; p++) { std::vector> a(1 << (N - p - 1), {1, 1}); for (int i = 0; i < M; i++) { int lt = L[i] & ((1 << p) - 1); mint l = L[i] >> p & 1 ? (1 << p) - lt : lt; int rt = (R[i] & ((1 << p) - 1)) + 1; mint r = R[i] >> p & 1 ? (1 << p) - rt : rt; int lb = L[i] >> (p + 1), rb = R[i] >> (p + 1); a[lb ^ rb][0] *= r - l; a[lb ^ rb][1] *= r + l; a[rb][1] *= -1; } bitwise_transform(a, [](auto &x, auto &y) { mint s = x[0] * y[1], t = x[1] * y[0]; x[0] *= y[0], x[1] *= y[1]; y[0] = s, y[1] = t; }); for (int j = 0; j < (1 << (N - p - 1)); j++) { ans[(j << 1 | 1) << p] = a[j][0]; } } ans[0] = 1; for (int i = 0; i < M; i++) { ans[0] *= R[i] - L[i] + 1; } bitwise_transform(ans, [](auto &x, auto &y) { mint t = x - y; x += y; y = t; }); const mint scale = 1 / mint(1 << N); for (int i = 0; i < 1 << N; i++) { std::cout << (ans[i] * scale).val() << "\n"; } return 0; }