#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
template <typename T>
inline T max(T &a, T &b) {
  return (a > b) ? (a) : (b);
}
template <typename T>
inline T min(T &a, T &b) {
  return (a < b) ? (a) : (b);
}
template <typename T>
inline T max(T &a, T &b, T &c) {
  if (a >= b && a >= c) return a;
  if (b >= c) return b;
  return c;
}
template <typename T>
inline T min(T &a, T &b, T &c) {
  if (a <= b && a <= c) return a;
  if (b <= c) return b;
  return c;
}
int compare(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
int main() {
  int n;
  scanf("%d", &n);
  int m = n / 3;
  int arr[1000 * 100][2];
  int *a = new int[n];
  int *b = new int[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i][0];
    arr[i][1] = i;
  }
  qsort(arr, n, sizeof(arr[0]), compare);
  for (int i = 0; i < m; ++i) {
    a[arr[i][1]] = 0;
    b[arr[i][1]] = arr[i][0];
  }
  int j = 0;
  for (int i = m; i <= n - 1; ++i) {
    if (j % 2) {
      a[arr[i][1]] = j / 2;
      b[arr[i][1]] = arr[i][0] - j / 2;
    } else {
      a[arr[i][1]] = arr[i][0] - j / 2;
      b[arr[i][1]] = j / 2;
    }
    ++j;
  }
  printf("YES\n");
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
  printf("\n");
  for (int i = 0; i < n; ++i) printf("%d ", b[i]);
  return 0;
}
