#include <iostream>
#include <string>
#define MAXN 101
#include <algorithm>
using namespace std;
typedef struct {
int cnt;
int seq;
string ti;
}Time;
bool GY(Time a, Time b) {
if(a.cnt == b.cnt) {
return a.ti < b.ti;
}
return a.cnt > b.cnt;
}
Time t[MAXN];
int s[MAXN], n;
int ma[ 6 ][ 2 ] = {{50, 50}, {65, 60}, {75, 70}, {85, 80}, {95, 90}, {100, 100}};
int vist[ 6 ];
void res() {
sort(t + 1, t + n + 1, GY);
for(int j = 1; j <= 4; ++ j) {
vist[ j ] = vist[ j ] / 2;
}
for(int i = 1; i <= n; ++ i) {
if(vist[t[ i ].cnt]) {
vist[t[ i ].cnt] --;
s[t[ i ].seq] = ma[t[ i ].cnt][ 0 ];
}
else {
s[t[ i ].seq] = ma[t[ i ].cnt][ 1 ];
}
}
for(int k = 1; k <= n; ++ k) {
cout << s[ k ] << endl;
}
cout << endl;
}
int main() {
while(cin >> n && n >= 0) {
memset(vist, 0, sizeof(vist));
for(int i = 1; i <= n; ++ i) {
cin >> t[ i ].cnt >> t[ i ].ti;
t[ i ].seq = i;
vist[t[ i ].cnt] ++;
}
res();
}
return 0;
}