#include <bits/stdc++.h>
using namespace std;
int s[100010];
int a[100010];
map<int, int> mx, my;
int main(void) {
  int N, i;
  cin >> N;
  for ((i) = 0; (i) < (int)(N); (i)++) scanf("%d", &s[i]);
  cout << "YES" << endl;
  if (N == 1) {
    cout << s[0] << endl << 0 << endl;
    return 0;
  }
  for ((i) = 0; (i) < (int)(N); (i)++) a[i] = s[i];
  sort(a, a + N);
  int X = (N + 2) / 3;
  int Y = N - X - X;
  for ((i) = 0; (i) < (int)(N); (i)++) {
    if (i < X) {
      mx[a[i]] = 0;
      my[a[i]] = a[i];
    } else if (i < X + X) {
      mx[a[i]] = a[i];
      my[a[i]] = 0;
    } else {
      mx[a[i]] = N - 1 - i;
      my[a[i]] = a[i] - (N - 1 - i);
    }
  }
  for ((i) = 0; (i) < (int)(N); (i)++) {
    printf("%d", mx[s[i]]);
    if (i == N - 1)
      printf("\n");
    else
      printf(" ");
  }
  for ((i) = 0; (i) < (int)(N); (i)++) {
    printf("%d", my[s[i]]);
    if (i == N - 1)
      printf("\n");
    else
      printf(" ");
  }
  return 0;
}
