#! /usr/bin/python
# -*- coding:utf-8 -*- 

import sys, os
import re
import json

def main():
    for line in sys.stdin:
        line = line.strip()
        fields = line.split('\t')
        age = json.loads(fields[3])
        ageProportion = age["age_and_proportion"]
        rst = max(ageProportion.iteritems(), key=lambda x:x[1])
        maxAge = ""
        if rst[0] == "unbelievable":
            maxAge=u"unknown"
        elif float(rst[1]) >= 0.5:
            maxAge = rst[0]
        else:
            maxAge=u"unknown"
        try:
            print '\t'.join([fields[0],fields[1],fields[2],maxAge.encode('utf-8'),fields[4]])
        except ValueError,e:
            continue

if __name__ == "__main__":
    main()

