mirror-of-erised

As Harry wants to know about the sorcerer's stone, he went to the Mirror of Erised and asked him ,"where is the stone?". The mirror put a condition that harry must answer a question first then he will tell about the stone.The mirror asked him to tell the maximum length of a stream of two strings, each of length N, consisting of alphabets only.  Furthermore , the mirror defined him stream as a subset of string in order. For example,
"abc","aeg",.. etc are streams of string "abcdefg".

Input:
First line of input contains number of Test Cases T.
Each test case starts with an integer N, size of two strings.
Next two lines contains N alphabets each.

Output:
For each test case print one integer, the maximum length of stream between the two strings.

Constraints :
1 ≤ T ≤ 10
1 ≤ N ≤ 100000

SAMPLE INPUT
2
2
ab
ba
3
abc
acb

SAMPLE OUTPUT
1
2

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: