#include <bits/stdc++.h>
using namespace std;
struct Data {
  int Value, Number;
};
bool operator<(Data A, Data B) { return A.Value < B.Value; }
int Get() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  int X = 0;
  while (c >= '0' && c <= '9') {
    X = X * 10 + c - 48;
    c = getchar();
  }
  return X;
}
void Output(int X) {
  int Len = 0, Data[10];
  while (X) {
    Data[Len++] = X % 10;
    X /= 10;
  }
  if (!Len) Data[Len++] = 0;
  while (Len--) putchar(Data[Len] + 48);
}
int main() {
  int N = Get();
  static Data A[100000];
  for (int i = 0; i < N; i++) {
    A[i].Value = Get();
    A[i].Number = i;
  }
  sort(A, A + N);
  static int X[100000], Y[100000];
  memset(X, 0, sizeof(X));
  memset(Y, 0, sizeof(Y));
  int K = (N - 1) / 3 + 1, T = N - K * 2;
  for (int i = 0; i < K; i++) {
    X[A[i].Number] = A[i].Value;
    Y[A[i + K].Number] = A[i + K].Value;
  }
  for (int i = K * 2; i < N; i++) {
    X[A[i].Number] = A[i].Value - N + i;
    Y[A[i].Number] = N - i;
  }
  printf("YES\n");
  for (int i = 0; i < N; i++) {
    Output(X[i]);
    putchar((i + 1 == N) ? '\n' : ' ');
  }
  for (int i = 0; i < N; i++) {
    Output(Y[i]);
    putchar((i + 1 == N) ? '\n' : ' ');
  }
  return 0;
}
