#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, l; cin >> n >> m >> l; int A[m][l] = {}; for(int i = 0; i < n; i++){ int a, b; cin >> a >> b; a--, b--; A[a][b - m]++; } vector dp(1 << l); dp[0] = 1; for(int i = 0; i < m; i++){ auto prv = dp; for(int j = 0; j < l; j++){ if(A[i][j] == 0) continue; mint coef = mint(2).pow(A[i][j]) - 1; for(int S = (1 << l) - 1; S >= 0; S--){ dp[S | (1 << j)] += dp[S] * coef; } } for(int S = 0; S < (1 << l); S++) dp[S] -= prv[S]; } cout << dp.back().val() << '\n'; }