// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, 0x28(%rsp)
movq %rsi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl $0x320, %edi            # imm = 0x320
callq 0x1100
leaq 0x10(%rsp), %rbx
movq %rax, (%rbx)
movq %rax, 0x8(%rbx)
movq %rax, %r15
addq $0x320, %r15            # imm = 0x320
movq %r15, 0x10(%rbx)
movl $0x320, %edx            # imm = 0x320
movq %rax, %rdi
xorl %esi, %esi
callq 0x1090
movq %r15, 0x8(%rbx)
leaq 0x30(%rsp), %rdi
movq %rsp, %rcx
movl $0x64, %esi
movq %rbx, %rdx
callq 0x1718
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1366
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x1110
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x10a0
subl $0x1, 0x10(%rsp)
jb 0x14c7
leaq 0xc(%rsp), %r13
leaq 0x8(%rsp), %rbp
movq %r14, %rdi
movq %rsp, %rsi
callq 0x10a0
cmpl $0x0, (%rsp)
jle 0x1453
xorl %r15d, %r15d
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x10a0
cmpl $0x0, 0x4(%rsp)
leaq (%r15,%r15,2), %r12
jle 0x13f5
xorl %ebx, %ebx
movq %r14, %rdi
movq %r13, %rsi
callq 0x10a0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x10a0
movl 0xc(%rsp), %eax
movl 0x8(%rsp), %ecx
movq 0x30(%rsp), %rdx
movq (%rdx,%r12,8), %rdx
movl %eax, (%rdx,%rbx,8)
movl %ecx, 0x4(%rdx,%rbx,8)
incq %rbx
movslq 0x4(%rsp), %rax
cmpq %rax, %rbx
jl 0x13ba
movq 0x30(%rsp), %rax
movq (%rax,%r12,8), %rbx
movq 0x8(%rax,%r12,8), %r12
cmpq %r12, %rbx
je 0x1443
movq %r12, %rax
subq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r12, %rsi
leaq 0xf0(%rip), %rcx        # 0x151c
callq 0x1a27
movq %rbx, %rdi
movq %r12, %rsi
leaq 0xde(%rip), %rdx        # 0x151c
callq 0x1b64
incq %r15
movslq (%rsp), %rax
cmpq %rax, %r15
jl 0x13a0
movq 0x28(%rsp), %rdx
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x3, 0x8(%rdx,%rcx)
movq -0x18(%rax), %rax
movl 0x18(%rdx,%rax), %ecx
movl $0xfffffefb, %esi       # imm = 0xFFFFFEFB
andl %esi, %ecx
orl $0x4, %ecx
movl %ecx, 0x18(%rdx,%rax)
leaq 0x30(%rsp), %rsi
callq 0x1524
movq 0x28(%rsp), %rdi
callq 0x1150
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10b0
subl $0x1, 0x10(%rsp)
jae 0x1388
leaq 0x30(%rsp), %rdi
callq 0x17b0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1507
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1514
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x1110
jmp 0x1514
movq %rax, %rbx
jmp 0x1514
jmp 0x1507
jmp 0x1507
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x17b0
movq %rbx, %rdi
callq 0x1170