#include <bits/stdc++.h>
using namespace std;
long long int n, a[100005], b[100005];
pair<long long int, long long int> s[100005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i].first;
    s[i].second = i;
  }
  sort(s, s + n);
  for (int i = 0; i < n / 3; i++) {
    a[s[i].second] = i;
    b[s[i].second] = s[i].first - (i);
  }
  for (int i = (n / 3); i < 2 * n / 3; i++) {
    b[s[i].second] = (i);
    a[s[i].second] = s[i].first - (i);
  }
  for (int i = (2 * n / 3); i < n; i++) {
    b[s[i].second] = n - i - 1;
    a[s[i].second] = s[i].first - (n - i - 1);
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  printf("\n");
  for (int i = 0; i < n; i++) {
    cout << b[i] << " ";
  }
  printf("\n");
  return 0;
}
