human
Assume that you have k one-dimensional segments s_1, s_2, ... s_k (each segment is denoted by two integers — its endpoints). Then you can build the following graph on these segments. The graph consists of k vertexes, and there is an edge between the i-th and the j-th vertexes (i ≠ j) if and only if the segments s_i and s_j intersect (there exists at least one point that belongs to both of them).

For example, if s_1 = [1, 6], s_2 = [8, 20], s_3 = [4, 10], s_4 = [2, 13], s_5 = [17, 18], then the resulting graph is the following:


A tree of size m is good if it is possible to choose m one-dimensional segments so that the graph built on these segments coincides with this tree.

You are given a tree, you have to find its good subtree with maximum possible size. Recall that a subtree is a connected subgraph of a tree.

Note that you have to answer q independent queries.

Input

The first line contains one integer q (1 ≤ q ≤ 15 ⋅ 10^4) — the number of the queries. 

The first line of each query contains one integer n (2 ≤ n ≤ 3 ⋅ 10^5) — the number of vertices in the tree.

Each of the next n - 1 lines contains two integers x and y (1 ≤ x, y ≤ n) denoting an edge between vertices x and y. It is guaranteed that the given graph is a tree.

It is guaranteed that the sum of all n does not exceed 3 ⋅ 10^5.

Output

For each query print one integer — the maximum size of a good subtree of the given tree.

Example

Input

1
10
1 2
1 3
1 4
2 5
2 6
3 7
3 8
4 9
4 10

Output

8

Note

In the first query there is a good subtree of size 8. The vertices belonging to this subtree are {9, 4, 10, 2, 5, 1, 6, 3}.
from  Can you provide a Python code to find its good subtree with maximum possible size?
assistant
#Here is Python code to find its good subtree with maximum possible size.
__future__ import division,print_function
import sys
le=sys.__stdin__.read().split("\n")[::-1]
aff=[]
#basculer en non enraciné
def f():
    n=int(le.pop())
    ar=[[] for k in range(n)]
    for k in range(n-1):
        a,b=map(int,le.pop().split())
        a-=1
        b-=1
        ar[a].append(b)
        ar[b].append(a)
    if n<5:
        aff.append(n)
        return None
    pf=[0]*n
    d=[len(k) for k in ar]
    nd=d[:]
    m=0
    pi=[k for k in range(n) if d[k]==1]
    for n2 in range(n):
        v=pi.pop()
        if d[v]==1:
            w=ar[v][0]
            if pf[w]:
                m=max(m,1+pf[w])
                pf[v]=1+pf[w]#pour leprincipe, normalement pas utiles
            else:
                pf[v]=1
                nd[w]-=1
                if nd[w]==1:
                    pi.append(w)
        else:
            m1,m2=0,0
            for k in ar[v]:
                if pf[k]:
                    if pf[k]>m2:
                        m2,m1=pf[k],m2
                    elif pf[k]>m1:
                        m1=pf[k]
                else:
                    nd[k] -= 1
                    if nd[k]==1:
                        pi.append(k)
            if n2!=n-1:
                m=max(m1+m2+d[v]-1,m)
            else:
                m=max(m1+m2+d[v]-1,m)
            pf[v]=m2+d[v]-1
    aff.append(m)
def fm():
    n=int(le.pop())
    ar=[[] for k in range(n)]
    for k in range(n-1):
        a,b=map(int,le.pop().split())
        a-=1
        b-=1
        ar[a].append(b)
        ar[b].append(a)
    p=[0]*n
    pf=[0]*n
    def parc(v,pere):
        p[v]=pere
        for k in ar[v]:
            if k!=pere:
                parc(k,v)
    parc(0,0)
    d=[len(k)-1 for k in ar]
    d[0]+=1
    nd=d[:]
    m=0
    pi=[k for k in range(n) if not(d[k])]
    while pi:
        v=pi.pop()
        nd[p[v]]-=1
        if not(nd[p[v]]):
            pi.append(p[v])
        te=sorted([pf[w] for w in ar[v]])
        if d[v]:
            pf[v]=te[-1]+d[v]
        else:
            pf[v]=1
        if d[v]>1:
       ...