#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9);
const int mod = inf + 7;
const double pi = acos(-1.0);
const double eps = 1e-9;
int n, a[100100], b[100100], ansa[100100], ansb[100100];
pair<int, int> second[100100];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &second[i].first);
    second[i].second = i;
  }
  sort(second, second + n);
  puts("YES");
  if (n == 1) {
    printf("0 %d", second[0].first);
    return 0;
  }
  int fb = n / 3, sb = fb, tb = n - fb - sb;
  swap(fb, tb);
  if (fb > sb + 1) {
    fb--;
    sb++;
  }
  for (int i = 0; i < fb; i++) {
    a[i] = i;
    b[i] = second[i].first - i;
  }
  for (int i = fb; i < fb + sb; i++) {
    b[i] = i;
    a[i] = second[i].first - i;
  }
  for (int i = fb + sb; i < n; i++) {
    b[i] = n - 1 - i;
    a[i] = second[i].first - b[i];
  }
  for (int i = 0; i < n; i++) {
    ansa[second[i].second] = a[i];
    ansb[second[i].second] = b[i];
  }
  for (int i = 0; i < n; i++) cout << ansa[i] << " ";
  puts("");
  for (int i = 0; i < n; i++) cout << ansb[i] << " ";
  return 0;
}
