#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const auto INF = 0x3f3f3f3f;
const int N = 1e5 + 5;
struct node {
  int id, x;
} s[N];
int a[N], b[N];
bool cmp(const struct node &u, const struct node &v) { return u.x < v.x; }
int main() {
  int n;
  scanf("%d", &n);
  int m = (n / 3) + 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s[i].x);
    s[i].id = i;
  }
  sort(s + 1, s + 1 + n, cmp);
  int ans = 0, t = 0, cnt = 0;
  for (int i = 1; i <= n; i++) {
    int id = s[i].id;
    if (s[i].x == 0) {
      m--;
      a[id] = 0, b[id] = 0;
      continue;
    }
    if (t == 2) {
      cnt = n - i + 1;
      a[id] = cnt;
      b[id] = s[i].x - cnt;
      continue;
    }
    ++ans;
    if (t == 0) {
      a[id] = 0, b[id] = s[i].x;
    } else {
      a[id] = s[i].x, b[id] = 0;
    }
    if (ans == m) {
      t++;
      ans = 0;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%d%c", a[i], i == n ? '\n' : ' ');
  for (int i = 1; i <= n; i++) printf("%d%c", b[i], i == n ? '\n' : ' ');
}
