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