import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  }
}
 import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr = new int[n]; arr new int[n] n for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    } {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      } i == n - 1 i n - 1 n 1 {
        System.out.println(arr[i]);
      } System.out.println(arr[i]) System.out.println System.out System System.out arr[i] arr i {
        System.out.print(arr[i] + " ");
      } System.out.print(arr[i] + " ") System.out.print System.out System System.out arr[i] + " " arr[i] arr i " " for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    } {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    } int key = arr[i]; key arr[i] arr i int j = i - 1; j i - 1 i 1 while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      } j >= 0 && arr[j] > key j >= 0 j 0 arr[j] > key arr[j] arr j key {
        arr[j + 1] = arr[j];
        j--;
      } arr[j + 1] = arr[j] arr[j + 1] arr j + 1 j 1 arr[j] arr j j-- j arr[j + 1] = key arr[j + 1] arr j + 1 j 1 key for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      } int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      } {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      } if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        } k == n - 1 k n - 1 n 1 {
          System.out.println(arr[k]);
        } System.out.println(arr[k]) System.out.println System.out System System.out arr[k] arr k {
          System.out.print(arr[k] + " ");
        } System.out.print(arr[k] + " ") System.out.print System.out System System.out arr[k] + " " arr[k] arr k " " String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for(int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
      if(i == n - 1) {
        System.out.println(arr[i]);
      } else {
        System.out.print(arr[i] + " ");
      }
    }
    for(int i = 1; i < n; i++) {
      int key = arr[i];
      int j = i - 1;
      while(j >= 0 && arr[j] > key) {
        arr[j + 1] = arr[j];
        j--;
      }
      arr[j + 1] = key;
      for(int k = 0; k < n; k++) {
        if(k == n - 1) {
          System.out.println(arr[k]);
        } else {
          System.out.print(arr[k] + " ");
        }
      }
    }
  }
}

