import java.io.*;

public class ServiziLudoteca {
  public static void giochiInComune(Ludoteca lt, int e1, int e2, String fout)
    throws IOException {
    
    FileWriter fw = new FileWriter(fout);
    PrintWriter out = new PrintWriter(fw);

    Gioco[] a = lt.tuttiIGiochi();
    for (int i = 0; i < a.length; i++) {
      if (lt.chiHaIlGioco(a[i]) == null &&
          a[i].getEtaMin() <= e1 &&
          a[i].getEtaMax() >= e1 &&
          a[i].getEtaMin() <= e2 &&
          a[i].getEtaMax() >= e2)
        out.println(a[i]);
    }
    
    fw.close();
    
  }
}
