Three friends got bored with their old card games, so decided to invent a new game. Let the name of three friends be player 1, player 2 and player 3.

In this new game, there are 26 different types of cards with infinite supply of every card. Each friend picks random number of cards in random order. They want to find out how close first two friends(player 1 and player 2) are with respect to the third friend(player 3). For this, they need to find the longest common subsequence of cards, that appears in the cards picked by first two friends(player 1 and player 2), without disturbing the order of given cards. Let us call this series as deck. But this deck should not be the string formed by the cards picked by third friend(player 3).

**Input:**

First line consists of T test cases.

Next Three lines of input consisting of three string of player 1, 2 and 3 respectively. (Only uppercase letters).

**Output:**

Print the length of the final string(deck) formed, if not possible print 0.

**Constraints:**

1<=T<=10

1<=|String|<=100

**Example:**

**Input:**

1

ABC

ACB

AB

**Output:**

2

**Explaination :**

All the possible subsequence are A, B, C, AC , AB.

Therefore, AC whose length is 2 is different from the series of Player 3.

Ans : Length is 2.

Vishal Arora 1 | 580 |

KohliAbhijeet | 210 |

TYSSSantosh | 196 |

VikaSh 2 | 192 |

rohanrko | 192 |

Aditya Singh 17 | 952 |

stupid_af | 841 |

Dhaya_Mohan | 645 |

Whatever_As_If | 613 |

TYSSSantosh | 611 |

akhayrutdinov | 4717 |

Quandray | 3746 |

sanjay05 | 3668 |

Ibrahim Nash | 3664 |

surbhi_7 | 2776 |