#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, j = 0;
  cin >> n;
  int a[n], b[n];
  pair<int, int> s[n];
  for (auto &i : s) cin >> i.first, i.second = j++;
  sort(s, s + n);
  map<int, int> mp;
  for (int i = 0; i < n; i++) mp[s[i].second] = i;
  for (int i = 0; i < (n + 2) / 3; i++) a[i] = i;
  for (int i = (n + 2) / 3; i < (2 * n + 2) / 3; i++) b[i] = i;
  for (int i = n - 1; i >= (2 * n + 2) / 3; i--) b[i] = n - 1 - i;
  for (int i = (n + 2) / 3; i < n; i++) a[i] = s[i].first - b[i];
  for (int i = 0; i < (n + 2) / 3; i++) b[i] = s[i].first - a[i];
  cout << "YES" << '\n';
  for (int i = 0; i < n; i++) cout << a[mp[i]] << " ";
  cout << '\n';
  for (int i = 0; i < n; i++) cout << b[mp[i]] << " ";
}
