#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> input[100010];
int a[100010];
int b[100010];
bool comp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &(input[i].first));
    input[i].second = i;
  }
  sort(input, input + n);
  for (int i = 0; i < n; i++) {
    if (i < n / 3) {
      a[input[i].second] = i;
      b[input[i].second] = input[i].first - i;
    } else {
      if (i < (2 * n) / 3) {
        b[input[i].second] = i;
        a[input[i].second] = input[i].first - i;
      } else {
        b[input[i].second] = (n - 1) - i;
        a[input[i].second] = input[i].first - (n - 1) + i;
      }
    }
  }
  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]);
}
