#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void chkmin(T &x, T y) {
  x = x > y ? y : x;
}
template <typename T>
void update(T &x, T y, T mod) {
  x = x + y > mod ? x + y - mod : x + y;
}
const int INF = (1ll << 30);
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = 0;
  } while (ch > '9' || ch < '0');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  x = f ? x : -x;
}
template <typename T>
void write(T x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int N = 1e5 + 7;
struct Node {
  int val, pos;
} a[N], b[N], s[N];
inline bool cmp1(Node a, Node b) { return a.val < b.val; }
inline bool cmp2(Node a, Node b) { return a.pos < b.pos; }
int n, t;
int main() {
  read(n);
  for (int i = 0; i < n; i++) read(s[i].val), s[i].pos = i;
  sort(s, s + n, cmp1);
  t = n % 3 ? n / 3 + 1 : n / 3;
  for (int i = 0; i < t; i++)
    a[i] = (Node){i, s[i].pos}, b[i] = (Node){s[i].val - a[i].val, s[i].pos};
  for (int i = t; i < n - t; i++)
    b[i] = (Node){i, s[i].pos}, a[i] = (Node){s[i].val - b[i].val, s[i].pos};
  for (int i = n - t; i < n; i++)
    b[i] = (Node){n - i - 1, s[i].pos},
    a[i] = (Node){s[i].val - b[i].val, s[i].pos};
  sort(a, a + n, cmp2);
  sort(b, b + n, cmp2);
  puts("YES");
  for (int i = 0; i < n; i++) printf("%d ", a[i].val);
  puts("");
  for (int i = 0; i < n; i++) printf("%d ", b[i].val);
  puts("");
  return 0;
}
