//SUST_ZadeedBoss_Fanclub
//code_korlei_life_ase
//na_korle_lifeNai
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using o_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define double long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
struct age
{
int l,r,val;
};
void solve ()
{
int d,j,g;cin>>d>>j>>g;
priority_queue<pair<int,pair<int,string>>>pq;
vector<age>v(g);
map<string,int>mp;
for(int i=0;i<j;i++)
{
string s;int a;
cin>>s>>a;
mp[s] = a;
}
for(int i=0;i<g;i++)
{
cin>>v[i].l>>v[i].r>>v[i].val;
//cout<<v[i].l<<" "<<v[i].r<<" "<<v[i].val<<endl;
}
int cnt=1e9,pp=0;
for(int i=0;i<d;i++)
{
int a,b;cin>>a>>b;
pp+=b;
for(int k=0;k<a;k++)
{
string s1,s2;int c;
cin>>s1>>s2>>c;
int pr=0;
auto it= mp.find(s2);
if(it!=mp.end())pr+=it->second;
for(int j=0;j<g;j++)
{
if(c>=v[j].l && c<=v[j].r)
{
pr+=v[j].val;
break;
}
}
pq.push({pr,{cnt--,s1+" "+s2+" "+to_string(c)}});
}
while (pq.size() && pp--)
{
cout<<pq.top().second.second<<endl;
pq.pop();
}
if (pp < 0) pp = 0;
}
cout<<"Still unvaccinated people: "<<pq.size()<<endl;
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int TCASE = 1;
// cin >> TCASE;
for (int tcase = 1; tcase <= TCASE; tcase++)
{
solve();
}
}