#include <bits/stdc++.h>
using namespace std;
const int MXn = 1000010;
struct stru {
  int val, num;
} s[MXn], a[MXn], b[MXn];
int n;
bool cmp1(const stru &x, const stru &y) { return x.val < y.val; }
bool cmp2(const stru &x, const stru &y) { return x.num < y.num; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i].val), s[i].num = i;
  sort(s + 1, s + n + 1, cmp1);
  int T = (n % 3) ? n / 3 + 1 : n / 3;
  for (int i = 1; i <= T; ++i) {
    a[i].num = b[i].num = s[i].num;
    a[i].val = i - 1, b[i].val = s[i].val - a[i].val;
  }
  for (int i = T + 1; i <= n - T; ++i) {
    a[i].num = b[i].num = s[i].num;
    b[i].val = i - 1, a[i].val = s[i].val - b[i].val;
  }
  for (int i = n - T + 1; i <= n; ++i) {
    a[i].num = b[i].num = s[i].num;
    b[i].val = n - i, a[i].val = s[i].val - b[i].val;
  }
  sort(a + 1, a + n + 1, cmp2);
  sort(b + 1, b + n + 1, cmp2);
  printf("YES\n");
  for (int i = 1; i <= n; ++i) printf("%d%c", a[i].val, i == n ? '\n' : ' ');
  for (int i = 1; i <= n; ++i) printf("%d%c", b[i].val, i == n ? '\n' : ' ');
  return 0;
}
