#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
	vector<int> foo = { 2, 1, 6, 1, 4, 6, 2, 1, 1 };
    auto last = end(foo);

    for(auto first = begin(foo); first < last; ++first) last = remove(next(first), last, *first);

    foo.erase(last, end(foo));
    
    for(const auto& i : foo) cout << i << ' ';
}