public ArrayList<TrainingExample> readInput() throws FileNotFoundException {
    for (int k = 1; k < 6; k++) {
      Scanner input = new Scanner(new File("file1.txt"));

      int fold = input.nextInt();
      int no_of_ex = input.nextInt();
      int perm_no = input.nextInt();

      String[] permutations;

      ArrayList<TrainingExample> trainingData = new ArrayList<>();
      trainingData = Utility.readData();

      ArrayList<TrainingExample> reArrangedTrainingData;

      // Used to find the errors for a given permutation, this array
      // contains errors of all the permutations according to index
      double errorEstimates[] = new double[perm_no];

      // used to skip to next line to read the permutations from the next
      // line
      input.nextLine();
      double num_perm = perm_no;

      // Taking the permutation from the dataSet
      while (input.hasNextLine()) {
        permutations = input.nextLine().split(" ");

        // Rearranging the permutation in the serial order- so that
        // working becomes easy
        reArrangedTrainingData = Utility.reArrange(trainingData, permutations);

        // Calling the KFold Cross Validation on the permutation for a
        // given fold, and finding the error estimate
        errorEstimates[perm_no - 1] = kfoldCV(reArrangedTrainingData, fold, k);
        perm_no--;
      }

      // Computing the error estimate
      double errorEstimate = 0;
      double temp = 0;

      // Summation of the errors across various permutation
      for (int i = 0; i < num_perm; i++) {
        temp = temp + errorEstimates[i];
      }

      // This gives the 'accurate error' estimate
      errorEstimate = temp / num_perm;

      temp = 0;

      // Calculates the summation of the values for computing variance
      for (int i = 0; i < num_perm; i++) {
        temp = temp + Math.pow((errorEstimate - errorEstimates[i]), 2);
      }

      // This gives the variance of all the permutations for a given 'k'
      // value
      double variance = 0;
      variance = temp / (num_perm - 1);

      // This is the standard deviation for a given 'k' value
      double standardDeviation = Math.sqrt(variance);

      // Prints the error and standard deviation
      System.out.println("Error:" + errorEstimate + "Standard Deviation:" + standardDeviation);

      // Calls gridLabelling.. wherein the function prints the label grid
      labelGrids(k);
    }
    return trainingData;
  }