public void solve() throws IOException {
    int n = nextInt();
    Unknown[] values = new Unknown[n];
    for (int x = 0; x < n; x++) {
      values[x] = new Unknown(nextLine());
    }

    int min = 0;
    for (int x = 0; x < n; x++) {
      boolean possible = values[x].setValue(min);
      min = values[x].getValue();
      if (!possible) {
        System.out.println("NO");
        return;
      }
    }
    
    for (int x = 1; x < n; x++) {
      if (values[x].getValue() <= values[x - 1].getValue()) {
        System.out.println("NO");
        return;
      }
    }

    System.out.println("YES");
    for (int x = 0; x < n; x++) {
      System.out.println(values[x].getValue());
    }
  }