#include <iostream>
#include <algorithm>
using namespace std;

template <class Init1, class Init2, class OutIt>
inline OutIt join_array(Init1 begin1, Init1 end1, Init2 begin2, Init2 end2, OutIt output)
{
	return copy(begin2, end2, copy(begin1, end1, output));
}

int main() {
	int a[] = {1,2,3,4};
	int b[] = {5,6,7,8};
	int c[8];
	
	join_array(a, a+4, b, b+4, c);
	
	for(int x : c) cout << x << endl;
	
	return 0;
}