public static <T extends DC> Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> getPhiMax(Set<Set<Pair<Pair<PT<Integer>,T>,
                                                                                                    Pair<PT<Integer>,T>>>> allPhis)
  { Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> temp=null;
    Similarity simIndexedMax;
    
    if(allPhis!=null)
    { Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>> phiMax=allPhis.getFst();
      Similarity simMax=getPhiSim(allPhis.getFst());
      for(Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> p=allPhis;p!=null;p=p.getNext())
      { Similarity sim=getPhiSim(p.getFst());
        if(sim.greater(simMax))
        { simMax=sim;
          phiMax=p.getFst(); 
          if(temp==null)
          { temp=new Set(phiMax,null);
          }
          else
          { temp=temp.ins(phiMax);
          }
        }  
        else
        { continue;
        }
      }
      if(temp!=null)
      { //System.out.println("temp:\n"+temp);
        temp=temp.getSet(8);
        //System.out.println("temp3:\n"+temp);
        simIndexedMax=getIndexedSim(temp.getFst());
        for(Set<Set<Pair<Pair<PT<Integer>,T>,Pair<PT<Integer>,T>>>> t=temp;t!=null;t=t.getNext())
        { Similarity simIndexed=getIndexedSim(t.getFst());
          if(simIndexed.greater(simIndexedMax))
          { simIndexedMax=simIndexed;
            phiMax=t.getFst();
          }    
          else
          { continue;
          }    
        }
      }
      else
      { throw new RuntimeException("Silly codes: temp==null?");
      }
      if(phiMax!=null)
      { return phiMax;
      }
      else
      { throw new RuntimeException("Silly codes: allPhis: "+allPhis+"\n phiMax: "+phiMax);
      } 
    }
    else
    { throw new RuntimeException("One-to-one mappings between two sets "+allPhis+" is null?");
    }
  }