#include <bits/stdc++.h>
using namespace std;
int N;
vector<pair<int, int> > S, A, B;
void read();
void soups_on();
int main() {
  ios::sync_with_stdio(false);
  read(), soups_on();
  return 0;
}
void read() {
  int si;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> si, S.push_back(make_pair(si, i));
}
void soups_on() {
  int bnd;
  cout << "YES\n";
  bnd = (N + 2) / 3;
  stable_sort(S.begin(), S.end());
  for (int i = 0; i < N; ++i) {
    if (i < bnd)
      A.push_back(make_pair(i, S[i].second)),
          B.push_back(make_pair(S[i].first - i, S[i].second));
    else if (i < 2 * bnd)
      A.push_back(make_pair(S[i].first - i, S[i].second)),
          B.push_back(make_pair(i, S[i].second));
    else {
      A.push_back(make_pair(S[i].first - (3 * bnd - i - 1), S[i].second));
      B.push_back(make_pair(3 * bnd - i - 1, S[i].second));
    }
  }
  for (int i = 0; i < N; ++i)
    swap(A[i].first, A[i].second), swap(B[i].first, B[i].second);
  stable_sort(A.begin(), A.end());
  stable_sort(B.begin(), B.end());
  for (int i = 0; i < N; ++i) cout << A[i].second << (i + 1 == N ? "\n" : " ");
  for (int i = 0; i < N; ++i) cout << B[i].second << (i + 1 == N ? "\n" : " ");
}
