#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
int n;
int w[N], s[N], a[N], b[N];
bool cmp(int a, int b) { return s[a] < s[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    w[i] = i;
  }
  sort(w, w + n, cmp);
  int l = n < 4 ? (n + 1) / 3 : (n + 2) / 3;
  for (int i = 0; i < l; i++) a[w[i]] = i, b[w[i]] = s[w[i]] - i;
  for (int i = l; i < 2 * l; i++) b[w[i]] = i, a[w[i]] = s[w[i]] - i;
  for (int i = 2 * l; i < n; i++)
    b[w[i]] = n - i - 1, a[w[i]] = s[w[i]] - b[w[i]];
  printf("YES\n");
  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;
}
