#include <bits/stdc++.h>
using namespace std;
pair<int, int> s[100010];
int a[100010], b[100010];
int main() {
  int N, P, i, x;
  scanf("%d\n", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &x);
    s[i] = make_pair(x, i);
  }
  sort(s, s + N);
  P = N / 3;
  for (i = 0; i < P; i++) {
    a[s[i].second] = s[i].first;
    b[s[i].second] = 0;
  }
  P = (2 * N) / 3;
  for (; i < P; i++) {
    a[s[i].second] = 0;
    b[s[i].second] = s[i].first;
  }
  for (; i < N; i++) {
    a[s[i].second] = s[i].first - (N - i - 1);
    b[s[i].second] = N - i - 1;
  }
  printf("YES\n");
  for (i = 0; i < N; i++) printf("%d ", a[i]);
  printf("\n");
  for (i = 0; i < N; i++) printf("%d ", b[i]);
  printf("\n");
  return 0;
}
