#include <bits/stdc++.h>
using namespace std;
int n, s[(1 << 17)], tn, p[(1 << 17)], a[(1 << 17)], b[(1 << 17)];
bool cmp(int a, int b) { return s[a] < s[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", s + i);
  for (int i = 0; i < n; ++i) p[i] = i;
  sort(p, p + n, cmp);
  tn = (n + 2) / 3;
  for (int i = 0; i < tn; ++i) {
    a[p[i]] = s[p[i]] - i;
    b[p[i]] = i;
  }
  for (int i = tn; i < tn + tn; ++i) {
    a[p[i]] = s[p[i]];
    b[p[i]] = 0;
  }
  for (int i = tn + tn; i < n; ++i) {
    a[p[i]] = n - i - 1;
    b[p[i]] = s[p[i]] - a[p[i]];
  }
  puts("YES");
  for (int i = 0; i < n; ++i) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ');
  for (int i = 0; i < n; ++i) printf("%d%c", b[i], i + 1 == n ? '\n' : ' ');
}
