#include<stdio.h>
#include<string.h>
union undata
{
int a;
double b;
char c[30];
} h[100001];
char ch[100001][30];
int main()
{
int a;
double b;
char c[20];
int n,m;
int i,j;
scanf("%d %d",&n,&m);
for (i=0; i<n; i++)
{
scanf("%s",&ch[i]);
if (strcmp(ch[i],"INT")==0)
{
scanf("%d",&h[i].a);
}
else if (strcmp(ch[i],"DOUBLE")==0)
{
scanf("%lf",&b);
h[i].b=b;
}
else if (strcmp(ch[i],"STRING")==0)
{
scanf("%s",&c);
strcpy(h[i].c,c);
}
}
for (j=0; j<m; j++)
{
scanf("%d",&i);
if (strcmp(ch[i],"INT")==0)
{
printf("%d\n",h[i].a);
}
else if (strcmp(ch[i],"DOUBLE")==0)
{
printf("%.2lf\n",h[i].b);
}
else if (strcmp(ch[i],"STRING")==0)
{
printf("%s\n",h[i].c);
}
}
return 0;
}