#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101010;
pair<int, int> arr[MAXN];
pair<int, int> a[MAXN], b[MAXN];
int N;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return a.second < b.second;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> arr[i].first;
    arr[i].second = i;
  }
  sort(arr, arr + N);
  int c3 = (N + 1) / 3;
  int c6 = (2 * N + 1) / 3;
  for (int i = 0; i < c3; i++) {
    a[i].first = arr[i].first;
    b[i].first = 0;
  }
  for (int i = c3; i < c6; i++) {
    a[i].first = 0;
    b[i].first = arr[i].first;
  }
  for (int i = c6; i < N; i++) {
    b[i].first = N - i - 1;
    a[i].first = arr[i].first - b[i].first;
  }
  for (int i = 0; i < N; i++) {
    a[i].second = b[i].second = arr[i].second;
  }
  sort(a, a + N, cmp);
  sort(b, b + N, cmp);
  cout << "YES" << endl;
  for (int i = 0; i < N; i++) cout << a[i].first << (i == N - 1 ? "\n" : " ");
  for (int i = 0; i < N; i++) cout << b[i].first << (i == N - 1 ? "\n" : " ");
  return 0;
}
