eolymp
bolt
Try our new interface for solving problems
Problems

Three sequences

Three sequences

Time limit 1 second
Memory limit 128 MiB

Three sequences of integers are given. Find the length of their longest common subsequence.

Input data

Contains the description of three sequences. Each sequence in given with two lines. First line contains the length of the sequence n~(1 \le n \le 100), and second line contains its elements (32 bits integers).

Output data

Print the length of the longest common subsequence.

Examples

Input example #1
3
1 2 3
3
1 3 2
3
2 1 3
Output example #1
2
Input example #2
3
1 2 3
3
4 5 6
3
1 3 5
Output example #2
0