private void solve()
	{
		// Build a dynamic programming table such that dyn[i][j] stores
		// the length of the longest subsequence for a[0..i] and b[0..j]
		int[][] dyn = new int[this.sizeA + 1][this.sizeB + 1];
		
		for (int i = 1; i <= this.sizeA; ++i)
		{
			for (int j = 1; j <= this.sizeB; ++j)
			{
				int isub1 = i - 1;
				int jsub1 = j - 1;
				dyn[i][j] = this.a[isub1] == this.b[jsub1]
					? dyn[isub1][jsub1] + 1
					: Math.max(dyn[i][jsub1], dyn[isub1][j]);
			}
		}
		
		int bi = this.sizeA;
		int bj = this.sizeB;
		int nextbi = bi - 1;
		int nextbj = bj - 1;
		
		LinkedList<Integer> list = new LinkedList<>();
		while (bi != 0 && bj != 0)
		{
			if (this.a[nextbi] == this.b[nextbj]) {
				list.add(this.a[nextbi]);
				bi = nextbi;
				bj = nextbj;
				--nextbi;
				--nextbj;
			}
			else if (dyn[bi][nextbj] > dyn[nextbi][bj])
			{
				bj = nextbj;
				--nextbj;
			} else {
				bi = nextbi;
				--nextbi;
			}
		}
		Iterator<Integer> outputIter = list.descendingIterator();
		StringBuilder builder = new StringBuilder();
		boolean first = true;
		while (outputIter.hasNext())
		{
			if (first) {
				first = false;
			} else {
				builder.append(' ');
			}
			builder.append(outputIter.next());
		}
		System.out.println(builder.toString());
	}