Competitions

# Sequences + Longest Common Subsequence

# Three sequences

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

#### Input

Contains the description of three sequences. Each sequence in given with two lines. The first line contains the length of the sequence **n** (**1** ≤ **n** ≤ **100**), and the second line contains its elements (**32** bits integers).

#### Output

Print the length of the longest common subsequence.

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