#include <bits/stdc++.h>
using namespace std;
const int MAXN(101);
const int MAXE(5000010);
const int MAXK(100010);
const int MAXC(2);
const int INF((INT_MAX - 1) / 2);
const int BASE(20);
const double LIM(1e50);
const double EPS(1e-5);
const double PER(0.02);
const double MUL(3.5);
template <typename T>
inline bool checkmax(T &a, const T &b) {
  return b > a ? ((a = b), true) : false;
}
template <typename T>
inline bool checkmin(T &a, const T &b) {
  return b < a ? ((a = b), true) : false;
}
template <typename T>
inline T ABS(T a) {
  return a < 0 ? -a : a;
}
struct E {
  int v, i;
  friend bool operator<(const E &a, const E &b) { return a.v < b.v; }
};
E e[100010];
int ans[2][100010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &e[i].v);
    e[i].i = i;
  }
  sort(e, e + n);
  if (n == 1) {
    printf("YES\n%d %d\n", 0, e[0].v);
    return 0;
  }
  int tn = n / 3;
  int n1 = tn, n2 = tn * 2;
  if (n % 3 == 1) {
    n1 += 1;
    n2 += 1;
  }
  if (n % 3 == 2) {
    n1 += 1;
    n2 += 2;
  }
  for (int i = 0; i < n1; ++i) {
    ans[0][e[i].i] = i;
    ans[1][e[i].i] = e[i].v - i;
  }
  for (int i = n1; i < n2; ++i) {
    ans[0][e[i].i] = e[i].v - i;
    ans[1][e[i].i] = i;
  }
  for (int i = n2; i < n; ++i) {
    ans[0][e[i].i] = e[i].v - (n - 1 - i);
    ans[1][e[i].i] = n - 1 - i;
  }
  printf("YES\n");
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < n; ++j) printf("%d ", ans[i][j]);
    printf("\n");
  }
  return 0;
}
