#include #include #include #include using namespace std; int n; int b[100005]; unordered_map> dic; int main(void) { int n; scanf("%d", &n); for(int i=0; i pr = dic[p]; x = pr.first, y = pr.second; } x = min(x, i); y = max(y, i); dic[p] = make_pair(x, y); } map> ordered_dic(dic.begin(), dic.end()); for(pair> kv : ordered_dic) { for(int i=kv.second.first; i<=kv.second.second; i++) { b[i] = kv.first; } } printf("%d", b[0]); for(int i=1; i