#include <bits/stdc++.h>
using namespace std;
int n;
int a[200000];
int col[200000];
vector<int> f, s, q, w;
void output() {
  if (!s.size()) s.push_back(f.back()), f.pop_back();
  if (!f.size()) f.push_back(s.back()), s.pop_back();
  for (int i = 0; i < f.size(); i++)
    printf("%d%c", f[i], " \n"[i + 1 == f.size()]);
  for (int i = 0; i < s.size(); i++)
    printf("%d%c", s[i], " \n"[i + 1 == s.size()]);
  exit(0);
}
void test() {
  int id[2] = {};
  f.clear();
  s.clear();
  for (int i = 0; i < n; i++) {
    if (col[i]) {
      if (col[i] == 1)
        f.push_back(a[i]);
      else
        s.push_back(a[i]);
      id[col[i] - 1]++;
    } else if ((id[1] + 1 >= w.size() || w[id[1]] != a[i]) &&
               id[0] < q.size() && q[id[0]] == a[i]) {
      f.push_back(a[i]);
      id[0]++;
    } else if (id[1] < w.size() && w[id[1]] == a[i]) {
      s.push_back(a[i]);
      id[1]++;
    } else
      return;
  }
  output();
}
void check(int u, int r, int v) {
  memset(col, 0, sizeof(col));
  col[u] = col[r] = 1;
  q.clear();
  w.clear();
  int cur = a[u], last = u;
  for (int i = u; i < n; i++)
    if (a[i] == cur) {
      col[i] = 1;
      q.push_back(cur);
      last = i;
      cur += v;
    }
  int j, k;
  for (j = 0; j < n && col[j]; j++)
    ;
  if (j == n) test();
  for (k = j + 1; k < n && col[k]; k++)
    ;
  if (k == n) f = q, s.clear(), s.push_back(a[j]), output();
  for (int i = 0; i < n; i++)
    if (col[i] == 1 && i != u && i != r) col[i] = 0;
  cur = a[j];
  col[j] = col[k] = 2;
  for (int i = j; i < n; i++)
    if (a[i] == cur) {
      w.push_back(cur);
      cur += a[k] - a[j];
    }
  test();
  if (last <= j) return;
  col[k] = 0;
  col[last] = 2;
  cur = a[j];
  w.clear();
  for (int i = j; i < n; i++)
    if (a[i] == cur) {
      w.push_back(cur);
      cur += a[last] - a[j];
    }
  test();
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  check(0, 1, a[1] - a[0]);
  check(0, 2, a[2] - a[0]);
  check(1, 2, a[2] - a[1]);
  puts("No solution");
  return 0;
}
