#include <bits/stdc++.h>
using namespace std;
template <class ty>
inline bool upmax(ty &a, ty b) {
  return b > a ? a = b, 1 : 0;
}
template <class ty>
inline bool upmin(ty &a, ty b) {
  return b < a ? a = b, 1 : 0;
}
template <class ty>
inline ty sqr(ty x) {
  return x * x;
}
const int N = 100010;
int n, a[N], b[N];
pair<int, int> s[N];
int main() {
  scanf("%d", &n);
  for (int i = 1, __r = n; i <= __r; i++) {
    scanf("%d", &(s[i].first));
    s[i].second = i;
  }
  sort(s + 1, s + n + 1);
  int need = n - (n + 2) / 3, p = -1;
  for (int i = n - need + 1, __r = n; i <= __r; i++) {
    p++;
    if (p & 1) {
      a[s[i].second] = p / 2;
      b[s[i].second] = s[i].first - p / 2;
    } else {
      b[s[i].second] = p / 2;
      a[s[i].second] = s[i].first - p / 2;
    }
  }
  for (int i = 1, __r = n - need; i <= __r; i++) {
    a[s[i].second] = s[i].first;
    b[s[i].second] = 0;
  }
  printf("YES\n");
  for (int i = 1, __r = n; i <= __r; i++)
    printf("%d%c", a[i], i < n ? ' ' : '\n');
  for (int i = 1, __r = n; i <= __r; i++)
    printf("%d%c", b[i], i < n ? ' ' : '\n');
}
