#include <bits/stdc++.h>
using namespace std;
pair<int, int> v[100005];
int a[100008];
int b[100005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i].first);
    v[i].second = i;
  }
  sort(v, v + n);
  int val = 0;
  int qt = (n + 2) / 3;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i < qt) {
      int idx = v[i].second;
      a[idx] = i;
      b[idx] = v[i].first - i;
    } else if (i < 2 * qt) {
      int idx = v[i].second;
      b[idx] = i;
      a[idx] = v[i].first - i;
    } else {
      int idx = v[i].second;
      b[idx] = n - 1 - i;
      a[idx] = v[i].first - b[idx];
    }
  }
  puts("YES");
  for (int i = 0; i < n; i++) {
    printf("%d ", a[i]);
  }
  puts("");
  for (int i = 0; i < n; i++) {
    printf("%d ", b[i]);
  }
  puts("");
  return 0;
}
