#include #include #include #include using namespace std; void repeat() { } int main() { int n; cin >> n; n++; vector a(n); map > range; for (int i = 1; i < n; i++) { cin >> a[i]; if (range[a[i]].first) range[a[i]] = make_pair(range[a[i]].first,i); else { range[a[i]] = make_pair(i, i); } } for (int i = 1; i < n;) { int j; for (j = i; j a[i]) break; else { if (j-1) cout << " "; cout << a[i]; } } i = j; } cout << endl; return 0; }