#include <bits/stdc++.h>   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a << endl;     err(++it, args...);   }   template <typename T>   void printV(const T &t) {     std::copy(t.cbegin(), t.cend(),               std::ostream_iterator<typename T::value_type>(std::cout,    ));     cout <<   n ;   }   template <typename T>   void printVV(const T &t) {     for (int i = 0; i < t.size(); i++) {       printf( %d:  , i);       printV(t[i]);     }   }   template <typename T, typename S>   void printVP(vector<pair<T, S>> vp) {     if (vp.empty()) {       cout <<   n ;       return;     }     for (int i = 0; i < vp.size() - 1; i++) {       cout <<  (  << vp[i].first <<     << vp[i].second <<  )  ;     }     cout <<  (  << vp[vp.size() - 1].first <<     << vp[vp.size() - 1].second          <<  ) n ;   }   template <typename T>   void printVVP(vector<vector<pair<T, T>>> vvp) {     for (int i = 0; i < vvp.size(); i++) {       cout << i <<  :  ;       printVP(vvp[i]);     }   }   vector<string> split(const string &s, char delim) {     vector<string> result;     stringstream ss(s);     string item;     while (getline(ss, item, delim)) {       result.push_back(item);     }     return result;   }   bool is_number(const string &s) {     string::const_iterator it = s.begin();     while (it != s.end() && isdigit(*it)) ++it;     return !s.empty() && it == s.end();   }   void fast() {     ios::sync_with_stdio(false);     cin.tie(NULL);   }   bool isValid(int r, int c, int R, int C) {     return (r >= 0 && r < R && c >= 0 && c < C);   }   struct Can {     long long x, r, id;   };   bool compareByX(const Can &lhs, const Can &rhs) { return lhs.x < rhs.x; }   class Person {    public:     string name, speak;     unordered_set<string> understands;     friend ostream &operator<<(ostream &os, const Person &p) {       os << p.name <<  (  << p.speak <<  ): ;       for (auto s : p.understands) os <<     << s;       return os;     }   };   vector<pair<int, int>> deltas = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};   const int INF = 1e9 + 10;   const long long inf = 1e18 + 10;   const long double PI = 3.14159265359;   int main() {     int N;     cin >> N;     vector<int> A(N), B(N);     for (int i = 0; i < (N); ++i) {       cin >> A[i];       B[i] = A[i];     }     sort(B.begin(), B.end());     unordered_map<int, int> m;     for (int i = 0; i < (N); ++i) m[B[i]] = i;     vector<int> C(N);     for (int i = 0; i < (N); ++i) {       C[i] = B[(m[A[i]] + 1) % N];     }     printV(C);   }   