#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; using ull = unsigned long long; constexpr ll mod=1e9+7; int dp[301][301][301]; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m,k; cin >> n >> m >> k; vector p(m),q(m),c(m); for(int i=0;i> p[i] >> q[i] >> c[i]; p[i]--; q[i]--; dp[2][q[i]][c[i]]++; } for(int i=2;i