// file name: 求两个集合的并集
// Written by: by_sknight
// Date: 2019/6/12

#include <bits/stdc++.h>
using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0);

	set<int> A, B, result;
	set<int>::iterator it;
	int n, m, x;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x;
		A.insert(x);
	}

	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> x;
		B.insert(x);
	}

	for (it = A.begin(); it != A.end(); it++) {
		result.insert(*it);
	}
	for (it = B.begin(); it != B.end(); it++) {
		result.insert(*it);
	}

	for (it = result.begin(); it != result.end(); it++) {
		cout << *it << endl;
	}
	
	return 0;
}
