#include<bits/stdc++.h>
using namespace std;
struct Country{
int num;//国家号
int gold;//金牌数
int medal;//奖牌数
int population;//人口
};
int main(){
int N = 0, M = 0;
int m = 0;
vector<Country> arr;
vector<Country> res;//参与排序的国家
Country c;
while(cin >> N >> M){
arr.clear();
res.clear();
for(int i = 0; i < N; i++){
c.num = i;
cin >> c.gold >> c.medal >> c.population;
arr.push_back(c);
}
for(int i = 0; i < M; i++){
cin >> m;
res.push_back(arr[m]);
}
//统计四种方式的排名
int rank[4] = {1};
int bestrank = 0;
for(int i = 0; i < M; i++){//每个国家
for(int t = 0; t < 4; t++){//每种排名方式
rank[t] = 1;
for(int j = 0; j < M; j++){
if(t == 0){//方式0
if(res[j].gold > res[i].gold)rank[t]++;
}else if(t == 1){//方式1
if(res[j].medal > res[i].medal)rank[t]++;
}else if(t == 2){//方式2
float gpj = 0.00, gpi = 0.00;
if(res[j].gold != 0)gpj = (float)res[j].gold/res[j].population;
if(res[i].gold != 0)gpi = (float)res[i].gold/res[i].population;
if(gpj > gpi)rank[t]++;
}else{//方式3
float mpj = 0.00, mpi = 0.00;
if(res[j].medal != 0)mpj = (float)res[j].medal/res[j].population;
if(res[i].medal != 0)mpi = (float)res[i].medal/res[i].population;
if(mpj > mpi)rank[t]++;
}
}
}
bestrank = 0;
for(int t = 1; t < 4; t++){
if(rank[t] < rank[bestrank])bestrank = t;
}
cout << rank[bestrank] << ':' << bestrank+1 << endl;
}
cout << endl;
}
return 0;
}