#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 10, maxm = (1 << 17), mod = 1e9 + 7, hash = 701;
const double PI = 3.14159265359, E = 2.71828;
pair<long long, long long> a[maxn], b[maxn], c[maxn];
int main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first, a[i].second = i;
  sort(a, a + n);
  for (int i = 0; i < (n + 2) / 3; i++)
    b[i].first = c[i].first = a[i].second, b[i].second = i,
    c[i].second = a[i].first - i;
  for (int i = (n + 2) / 3; i < 2 * n / 3 + (n % 3 == 1); i++)
    b[i].first = c[i].first = a[i].second, c[i].second = i,
    b[i].second = a[i].first - i;
  for (int i = 2 * n / 3 + (n % 3 == 1); i < n; i++)
    b[i].first = c[i].first = a[i].second, c[i].second = n - i - 1,
    b[i].second = a[i].first - n + i + 1;
  sort(b, b + n), sort(c, c + n);
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << b[i].second << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << c[i].second << " ";
  return 0;
}
