import java.util.*; public class JoinSortedArrays { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] arr1 = new int[n]; for (int i = 0; i < n; i++) { arr1[i] = scanner.nextInt(); } int m = scanner.nextInt(); int[] arr2 = new int[m]; for (int i = 0; i < m; i++) { arr2[i] = scanner.nextInt(); } List mergedList = new ArrayList<>(); for (int num : arr1) mergedList.add(num); for (int num : arr2) mergedList.add(num); Collections.sort(mergedList); for (int num : mergedList) { System.out.print(num + " "); } } }