#include <bits/stdc++.h>
using namespace std;
const int Maxn = 100 * 1000 + 10;
int n, s[Maxn], a[Maxn];
pair<int, int> arr[Maxn];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
    arr[i] = make_pair(s[i], i);
  }
  sort(arr, arr + n);
  for (int i = 0; i < ((n + 2) / 3); i++)
    a[arr[i + (n / 3)].second] = (n / 3) + i;
  int cnt = n - 1;
  for (int i = (n / 3) + (n + 2) / 3; i < n; i++) {
    a[arr[cnt].second] = n - cnt;
    cnt--;
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  for (int i = 0; i < n; i++) cout << s[i] - a[i] << " ";
  cout << endl;
  return 0;
}
