// hleda maxima a minima v datovem souboru
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
#define RADKU 5      
#define POCET 10000
int main(void){
  ifstream fr;
  int radek,i,pozice_max,pozice_min,max,min,n;
  fr.open("random.txt");  
  cout << "radek     max   pozice_max   min   pozice_min\n";
  cout << "=============================================\n";
  for (radek = 1; radek <= RADKU; radek++){
    fr >> n;
    max = min = n;      // prvni cislo je pocatecni min i max
    pozice_max = pozice_min = 1;
    for (i = 2; i <= POCET; i++){
      fr >> n;
      if(n > max){ 
        max = n;         // "n" je nove maximum
        pozice_max = i;
      }
      if(n < min){
        min = n;        //  "n" je nove minimum
        pozice_min = i;
      }
    }
    cout << setw(3) << radek;
    cout << setw(9) << max << setw(12) << pozice_max;
    cout << setw(7) << min << setw (11) << pozice_min << endl; 
  }
  fr.close();
}
