// File: hcoona[P]POJ-Solutions/P1018.cpp
// Function: POJ::P1018::Run(std::istream&, std::ostream&)
void P1018::Run(istream &in, ostream &out)
    {
        const int NMax = 100;
        const int MMax = 100;
        vector<vector<pair<int, int> > > deviceData(NMax, vector<pair<int, int> >(MMax));

        int t;
        in >> t;
        while (t--) {
            int n;
            in >> n;

            for (int nidx = 0; nidx < n; nidx++) {
                int m;
                in >> m;
                for (int midx = 0; midx < m; midx++) {
                    int b, p;
                    in >> b >> p;
                    deviceData[nidx][midx] = make_pair(b, p);
                }
                sort(
                    deviceData[nidx].begin(),
                    deviceData[nidx].end(),
                    PredByFirstGt<int, int>);
            }

            out << setprecision(3) << fixed << Solve(deviceData) << endl;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movl $0x64, -0x1c(%rbp)
movl $0x64, -0x20(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x2ad0
movq -0xb0(%rbp), %rdx
leaq -0x50(%rbp), %rdi
movl $0x64, %esi
callq 0x2af0
jmp 0x2307
leaq -0x65(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x2b60
movq -0xc0(%rbp), %rcx
leaq -0x38(%rbp), %rdi
movl $0x64, %esi
leaq -0x50(%rbp), %rdx
callq 0x2b80
jmp 0x2332
leaq -0x65(%rbp), %rdi
callq 0x2c00
leaq -0x50(%rbp), %rdi
callq 0x2c20
leaq -0x51(%rbp), %rdi
callq 0x2c80
movq -0x10(%rbp), %rdi
leaq -0x6c(%rbp), %rsi
callq 0x2090
jmp 0x235c
jmp 0x235e
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x6c(%rbp)
cmpl $0x0, %eax
je 0x25b1
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2090
jmp 0x2381
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x70(%rbp), %eax
jge 0x2500
movq -0x10(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x2090
jmp 0x23a3
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x78(%rbp), %eax
jge 0x2492
movq -0x10(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x2090
movq %rax, -0xc8(%rbp)
jmp 0x23cc
movq -0xc8(%rbp), %rdi
leaq -0x84(%rbp), %rsi
callq 0x2090
jmp 0x23e1
leaq -0x80(%rbp), %rdi
leaq -0x84(%rbp), %rsi
callq 0x2ca0
movq %rax, -0xd0(%rbp)
jmp 0x23fa
movq -0xd0(%rbp), %rax
movq %rax, -0x8c(%rbp)
movslq -0x74(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x2cd0
movq %rax, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x2cf0
movq %rax, %rdi
leaq -0x8c(%rbp), %rsi
callq 0x2d10
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x23aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x246a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x65(%rbp), %rdi
callq 0x2c00
leaq -0x50(%rbp), %rdi
callq 0x2c20
leaq -0x51(%rbp), %rdi
callq 0x2c80
jmp 0x25c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2e40
jmp 0x25c3
movslq -0x74(%rbp), %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x2cd0
movq %rax, %rdi
callq 0x2d90
movq -0xd8(%rbp), %rdi
movq %rax, -0x98(%rbp)
movslq -0x74(%rbp), %rsi
callq 0x2cd0
movq %rax, %rdi
callq 0x2dc0
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
leaq 0xe7(%rip), %rdx        # 0x25d0
callq 0x2d40
jmp 0x24f0
jmp 0x24f2
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x2388
movq -0x18(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl $0x3, %edi
callq 0x2df0
movl %eax, -0xdc(%rbp)
jmp 0x251d
movq -0xe8(%rbp), %rdi
movl -0xdc(%rbp), %eax
movl %eax, -0xa4(%rbp)
movl -0xa4(%rbp), %esi
callq 0x2130
movq %rax, -0xf0(%rbp)
jmp 0x2544
movq -0xf0(%rbp), %rdi
leaq 0x8be(%rip), %rsi       # 0x2e10
callq 0x2050
movq %rax, -0xf8(%rbp)
jmp 0x2560
movq -0xb8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x25f0
movsd %xmm0, -0x100(%rbp)
jmp 0x257a
movsd -0x100(%rbp), %xmm0
movq -0xf8(%rbp), %rdi
callq 0x2160
movq %rax, -0x108(%rbp)
jmp 0x2597
movq -0x108(%rbp), %rdi
movq 0xaa1b(%rip), %rsi      # 0xcfc0
callq 0x2100
jmp 0x25ac
jmp 0x235e
leaq -0x38(%rbp), %rdi
callq 0x2e40
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x2150
nopl (%rax)