#include <bits/stdc++.h>
using namespace std;
struct node {
  int data, num;
} s[100001];
int a[100001], b[100001];
int N;
bool cmp(node a, node b) { return a.data < b.data; }
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    s[i].data = x;
    s[i].num = i;
  }
  sort(s + 1, s + 1 + N, cmp);
  for (int i = 1; i <= N / 3; i++) {
    int j = s[i].num;
    a[j] = i - 1;
    b[j] = s[i].data - a[j];
    if (b[j] < 0) {
      printf("NO\n");
      return 0;
    }
  }
  for (int i = N / 3 + 1; i <= 2 * N / 3; i++) {
    int j = s[i].num;
    b[j] = i - 1;
    a[j] = s[i].data - b[j];
    if (a[j] < 0) {
      printf("NO\n");
      return 0;
    }
  }
  for (int i = 2 * N / 3 + 1; i <= N; i++) {
    int j = s[i].num;
    b[j] = N - i;
    a[j] = s[i].data - b[j];
    if (a[j] < 0) {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= N - 1; i++) printf("%d ", a[i]);
  printf("%d\n", a[N]);
  for (int i = 1; i <= N - 1; i++) printf("%d ", b[i]);
  printf("%d\n", b[N]);
  return 0;
}
