#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 1000005
struct
{
int num, time;
}a[N];
int main()
{
int t, top = 0;
memset(a, 0, sizeof(a));
while(~scanf("%d", &t))
{
bool mk = 0;
for(int i = 0; i < top; i++)
{
if(t == a[i].num)
{
a[i].time++;
mk = 1;
break;
}
}
if(!mk)
{
a[top].num = t;
a[top].time = 1;
top++;
}
}
for(int i = 0; i < top; i++)
{
printf("%d %d\n", a[i].num, a[i].time);
}
}