#include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) typedef long long ll; const ll mod=1e9+7 ; int main(){ int n,m,k; cin>>n>>m>>k; assert(n<=24); int a[n]; rep(i,n)cin>>a[i]; pair> p[m]; rep(i,m)cin>>p[i].first>>p[i].second.first>>p[i].second.second; int all=1<