#include<iostream>
#include<cmath>
#include<string.h>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<string>
#include<map>
#include<vector>
typedef long long ll;
using namespace std;
struct node
{
string name;
string name2;
int pts;
int gms;
int goal;
int suffer;
int gs;
double p;
int index;
}team[
30];
bool cmp1(
const node&a,
const node&b )
{
return a.name2<b.name2;
}
bool cmp2(
const node&a,
const node&b)
{
if(a.pts!=b.pts)
return a.pts>b.pts;
else if(a.gs!=b.gs)
return a.gs>b.gs;
else if(a.goal!=b.goal)
return a.goal>b.goal;
else
return a.index<b.index;
}
void print(
bool f,
int cnt,node a)
{
if(!f)
printf(
"-.",cnt);
else
printf(
" ");
printf(
"sMMMMM",a.name.c_str(),a.pts,a.gms,a.goal,a.suffer,a.gs);
if(a.gms==
0)
printf(
" N/A\n");
else printf(
"%7.2f\n",a.p);
}
bool eq(
const node&a ,
const node&b)
{
if(a.pts==b.pts&&a.gs==b.gs&&a.goal==b.goal)
return true;
else
return false;
}
int main()
{
int n,m;
char c[
20];
int flag=
0;
int z=
1;
while(~
scanf(
"%d%d",&n,&m)&&(n||m))
{
if(flag)
printf(
"\n");
for(
int i=
0;i<n;i++)
{
scanf(
" %s",c);
team[i].name=c;
team[i].name2.clear();
int len=
strlen(c);
for(
int j=
0;j<len;j++)
team[i].name2+=
tolower(c[j]);
team[i].pts=team[i].gms=team[i].goal=team[i].suffer=
0;
}
sort(team,team+n,cmp1);
map<string,int> mmap;
for(
int i=
0;i<n;i++)
{
team[i].index=i;
mmap[team[i].name]=i;
}
char c1[
20],c2[
20];
int n1,n2;
int goal1,goal2;
for(
int i=
0;i<m;i++)
{
scanf(
"%s %d - %d %s",c1,&goal1,&goal2,c2);
n1=mmap[c1];
n2=mmap[c2];
team[n1].goal+=goal1;
team[n2].goal+=goal2;
team[n1].gms++;
team[n2].gms++;
team[n1].suffer+=goal2;
team[n2].suffer+=goal1;
if(goal1>goal2)
team[n1].pts+=
3;
else if(goal1<goal2)
team[n2].pts+=
3;
else
{
team[n1].pts++;
team[n2].pts++;
}
}
for(
int i=
0;i<n;i++)
{
team[i].gs=team[i].goal-team[i].suffer;
if(!team[i].gms)
continue;
team[i].p=(team[i].pts*
100.0)/(team[i].gms*
3.0);
}
sort(team,team+n,cmp2);
print(
false,
1,team[
0]);
for(
int i=
1;i<n;i++)
print(eq(team[i],team[i-
1]),i+
1,team[i]);
flag=
1;
}
return 0;
}