// File: ekg[P]tsvtools/tsvavg.cpp
// Function: main
int main(void) {

    string header;
    vector<string> header_fields;
    getline(cin, header);

    if (header.empty()) {
        cerr << "could not get header line" << endl;
        exit(1);
    }

    split(header, '\t', header_fields);
    map<string, unsigned int> counts;
    map<string, long double> totals;

    string line;
    getline(cin, line);
    while (!line.empty()) {
        vector<string> fields = split(line, '\t');
        int i = 0;
        for (vector<string>::iterator f = header_fields.begin(); f != header_fields.end(); ++f) {
            const string& field = *f;
            ++counts[field];
            totals[field] += atof(fields[i++].c_str());
        }
        getline(cin, line);
    }

    vector<string> averages;
    for (vector<string>::iterator f = header_fields.begin(); f != header_fields.end(); ++f) {
        const string& field = *f;
        if (counts[field] != 0) {
            stringstream s;
            s << totals[field] / counts[field];
            averages.push_back(s.str());
        }
    }

    cout << header << endl
         << join(averages, "\t") << endl;

    return 0;

}

// Assembly:
subq $0x3a8, %rsp            # imm = 0x3A8
movl $0x0, 0x3a4(%rsp)
leaq 0x380(%rsp), %rdi
movq %rdi, 0x90(%rsp)
callq 0x22b0
leaq 0x368(%rsp), %rdi
callq 0x2ac0
movq 0x90(%rsp), %rsi
movq 0x9ae5(%rip), %rdi      # 0xbfd8
callq 0x2060
jmp 0x24fa
leaq 0x380(%rsp), %rdi
callq 0x2310
testb $0x1, %al
jne 0x250d
jmp 0x2563
movq 0x9adc(%rip), %rdi      # 0xbff0
leaq 0x5ae9(%rip), %rsi      # 0x8004
callq 0x21d0
movq %rax, 0x88(%rsp)
jmp 0x252a
movq 0x88(%rsp), %rdi
movq 0x9a7f(%rip), %rsi      # 0xbfb8
callq 0x2210
jmp 0x2540
movl $0x1, %edi
callq 0x2270
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x2a98
leaq 0x380(%rsp), %rdi
movl $0x9, %esi
leaq 0x368(%rsp), %rdx
callq 0x60c0
jmp 0x257f
leaq 0x328(%rsp), %rdi
callq 0x2ad0
leaq 0x2f8(%rsp), %rdi
callq 0x2ae0
leaq 0x2d8(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x22b0
movq 0x80(%rsp), %rsi
movq 0x9a1b(%rip), %rdi      # 0xbfd8
callq 0x2060
jmp 0x25c4
jmp 0x25c6
leaq 0x2d8(%rsp), %rdi
callq 0x2310
xorb $-0x1, %al
testb $0x1, %al
jne 0x25de
jmp 0x2771
leaq 0x2c0(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
movl $0x9, %edx
callq 0x61d0
jmp 0x25fa
movl $0x0, 0x2bc(%rsp)
leaq 0x368(%rsp), %rdi
callq 0x2af0
movq %rax, 0x2b0(%rsp)
leaq 0x368(%rsp), %rdi
callq 0x2b60
movq %rax, 0x2a8(%rsp)
leaq 0x2b0(%rsp), %rdi
leaq 0x2a8(%rsp), %rsi
callq 0x2b20
testb $0x1, %al
jne 0x264d
jmp 0x2749
leaq 0x2b0(%rsp), %rdi
callq 0x2b90
movq %rax, 0x2a0(%rsp)
movq 0x2a0(%rsp), %rsi
leaq 0x328(%rsp), %rdi
callq 0x2ba0
movq %rax, 0x78(%rsp)
jmp 0x267e
movq 0x78(%rsp), %rax
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movslq 0x2bc(%rsp), %rsi
movl %esi, %eax
incl %eax
movl %eax, 0x2bc(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0x2c90
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
callq 0x2290
movsd %xmm0, 0x98(%rsp)
fldl 0x98(%rsp)
fstpt 0x64(%rsp)
movq 0x2a0(%rsp), %rsi
leaq 0x2f8(%rsp), %rdi
callq 0x2cb0
movq %rax, 0x70(%rsp)
jmp 0x26e9
movq 0x70(%rsp), %rax
fldt 0x64(%rsp)
fldt (%rax)
faddp %st, %st(1)
fstpt (%rax)
leaq 0x2b0(%rsp), %rdi
callq 0x2da0
jmp 0x261a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x2a71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0x2dc0
jmp 0x2a71
movq 0x9888(%rip), %rdi      # 0xbfd8
leaq 0x2d8(%rsp), %rsi
callq 0x2060
jmp 0x275f
leaq 0x2c0(%rsp), %rdi
callq 0x2dc0
jmp 0x25c6
leaq 0x288(%rsp), %rdi
callq 0x2ac0
leaq 0x368(%rsp), %rdi
callq 0x2af0
movq %rax, 0x280(%rsp)
leaq 0x368(%rsp), %rdi
callq 0x2b60
movq %rax, 0x278(%rsp)
leaq 0x280(%rsp), %rdi
leaq 0x278(%rsp), %rsi
callq 0x2b20
testb $0x1, %al
jne 0x27c6
jmp 0x2951
leaq 0x280(%rsp), %rdi
callq 0x2b90
movq %rax, 0x270(%rsp)
movq 0x270(%rsp), %rsi
leaq 0x328(%rsp), %rdi
callq 0x2ba0
movq %rax, 0x58(%rsp)
jmp 0x27f7
movq 0x58(%rsp), %rax
cmpl $0x0, (%rax)
je 0x293d
leaq 0xe8(%rsp), %rdi
callq 0x2130
jmp 0x2814
leaq 0xf8(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x270(%rsp), %rsi
leaq 0x2f8(%rsp), %rdi
callq 0x2cb0
movq %rax, 0x50(%rsp)
jmp 0x283d
movq 0x50(%rsp), %rax
fldt (%rax)
fstpt 0x34(%rsp)
movq 0x270(%rsp), %rsi
leaq 0x328(%rsp), %rdi
callq 0x2ba0
movq %rax, 0x40(%rsp)
jmp 0x2864
movq 0x48(%rsp), %rdi
fldt 0x34(%rsp)
movq 0x40(%rsp), %rax
movl (%rax), %eax
movq %rax, 0xa0(%rsp)
fildll 0xa0(%rsp)
fdivrp %st, %st(1)
movq %rsp, %rax
fstpt (%rax)
callq 0x2260
jmp 0x2891
leaq 0xc8(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x21c0
jmp 0x28a8
leaq 0x288(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x2e20
jmp 0x28bf
leaq 0xc8(%rsp), %rdi
callq 0x20f0
leaq 0xe8(%rsp), %rdi
callq 0x2150
jmp 0x293d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x2a64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
jmp 0x292b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x20f0
leaq 0xe8(%rsp), %rdi
callq 0x2150
jmp 0x2a64
jmp 0x293f
leaq 0x280(%rsp), %rdi
callq 0x2da0
jmp 0x2793
movq 0x9670(%rip), %rdi      # 0xbfc8
leaq 0x380(%rsp), %rsi
callq 0x21a0
movq %rax, 0x28(%rsp)
jmp 0x296c
movq 0x28(%rsp), %rdi
movq 0x9640(%rip), %rsi      # 0xbfb8
callq 0x2210
movq %rax, 0x20(%rsp)
jmp 0x2984
leaq 0x5693(%rip), %rdx      # 0x801e
leaq 0xa8(%rsp), %rdi
leaq 0x288(%rsp), %rsi
callq 0x2e50
jmp 0x29a2
movq 0x20(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x21a0
movq %rax, 0x18(%rsp)
jmp 0x29bb
movq 0x18(%rsp), %rdi
movq 0x95f1(%rip), %rsi      # 0xbfb8
callq 0x2210
jmp 0x29ce
leaq 0xa8(%rsp), %rdi
callq 0x20f0
movl $0x0, 0x3a4(%rsp)
leaq 0x288(%rsp), %rdi
callq 0x2dc0
leaq 0x2d8(%rsp), %rdi
callq 0x20f0
leaq 0x2f8(%rsp), %rdi
callq 0x2f80
leaq 0x328(%rsp), %rdi
callq 0x2f90
leaq 0x368(%rsp), %rdi
callq 0x2dc0
leaq 0x380(%rsp), %rdi
callq 0x20f0
movl 0x3a4(%rsp), %eax
addq $0x3a8, %rsp            # imm = 0x3A8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x360(%rsp)
movl %eax, 0x35c(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x20f0
leaq 0x288(%rsp), %rdi
callq 0x2dc0
leaq 0x2d8(%rsp), %rdi
callq 0x20f0
leaq 0x2f8(%rsp), %rdi
callq 0x2f80
leaq 0x328(%rsp), %rdi
callq 0x2f90
leaq 0x368(%rsp), %rdi
callq 0x2dc0
leaq 0x380(%rsp), %rdi
callq 0x20f0
movq 0x360(%rsp), %rdi
callq 0x2320
nop