#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, a[N], b[N];
pair<int, int> s[N];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) {
    int si;
    scanf("%d", &si);
    s[i] = make_pair(si, i);
  }
  sort(s, s + n);
  int B = (n - 1) / 3 + 1;
  for (int i = (B << 1); i < (n); ++i) {
    b[s[i].second] = n - i - 1;
    a[s[i].second] = s[i].first - b[s[i].second];
  }
  for (int i = (B); i < (B << 1); ++i) {
    b[s[i].second] = i;
    a[s[i].second] = s[i].first - i;
  }
  for (int i = (0); i < (B); ++i) {
    a[s[i].second] = i;
    b[s[i].second] = s[i].first - i;
  }
  puts("YES");
  for (int i = (0); i < (n); ++i) printf("%d%c", a[i], " \n"[i == n - 1]);
  for (int i = (0); i < (n); ++i) printf("%d%c", b[i], " \n"[i == n - 1]);
  return 0;
}
