#include <bits/stdc++.h>
using namespace std;
const int INF = 1000 * 1000 * 1000;
const int MAXN = 100001;
pair<int, int> s[MAXN];
int a[MAXN], b[MAXN];
int ansa[MAXN], ansb[MAXN];
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < (N); ++i) {
    scanf("%d", &s[i].first);
    s[i].second = i;
  }
  sort(s, s + N);
  int bl = N / 3 + (N % 3 != 0);
  for (int i = 0; i < (bl); ++i) {
    a[i] = i;
    b[i] = s[i].first - a[i];
  }
  for (int i = bl; i < 2 * bl; ++i) {
    b[i] = i;
    a[i] = s[i].first - b[i];
  }
  for (int i = 2 * bl; i < N; ++i) {
    b[i] = N - i - 1;
    a[i] = s[i].first - b[i];
  }
  for (int i = 0; i < (N); ++i) {
    ansa[s[i].second] = a[i];
  }
  for (int i = 0; i < (N); ++i) {
    ansb[s[i].second] = b[i];
  }
  puts("YES");
  for (int i = 0; i < (N); ++i) {
    printf("%d ", ansa[i]);
  }
  puts("");
  for (int i = 0; i < (N); ++i) {
    printf("%d ", ansb[i]);
  }
  return 0;
}
