{ UØdavinio autorÓ: J×ratÓ Sk×pienÓ, Matematikos ir informatikos
  instituto asistentÓ;
  SprendimÐ bei testus rengÓ: Justas Kranauskas, VU MIF studentas.

IdÓja:
    sudarome paØinÑiÖ grafÐ: grafo virÕ×nÓs ØymÓs asmenis, o briaunos jungs
du asmenis, jei jie yra paØystami. Kadangi po renginio visi asmenys turÓtÖ
b×ti paØÔstami, tai Õis grafas bus jungus. Jeigu Ô renginÔ neatvyks koks nors
asmuo ir todÓl ne visi asmenys susipaØins, tai grafas taps nejungus. Vadinasi
reikia rasti bent vienÐ tokiÐ grafo virÕ×nÒ, kuriÐ paÕalinus, grafas suskils
Ô nejungius pografius}
{$A+,B+,D+,E-,F+,G-,I+,L+,N+,O+,P+,Q-,R-,S-,T-,V+,X+,Y+}
{$M 16384,0,655360}
program pazintys;
  const fin = 'pazintys.dat';
        fout = 'pazintys.rez';
        maxn = 200;
  type sarasas = ^elem;
       elem = record
                virs : integer;
                kita : sarasas;
              end;
       virsmas = array [1..maxn] of sarasas;
       bmas = array [1..maxn] of boolean;
  var vm : virsmas;
      f : text;
      i, ii, n, m, v : integer;
      tmp : sarasas;
      bm : bmas;
      ok : boolean;
  procedure dfs (is, ne: integer);
    var tmp : sarasas;
  begin
    bm[is] := true;
    tmp := vm[is];
    while tmp <> nil do
      begin
        if (tmp^.virs <> ne) and not bm[tmp^.virs]
          then dfs (tmp^.virs, ne);
        tmp := tmp^.kita;
      end;
  end;
begin
  assign (f, fin);
  reset (f);
  readln (f, n);
  for i := 1 to n do
    vm[i] := nil;
  for i := 1 to n do
    begin
      read (f, m);
      for ii := 1 to m do
        begin
          read (f, v);
          new (tmp);
          tmp^.virs := v;
          tmp^.kita := vm[i];
          vm[i] := tmp;
        end;
      readln (f);
    end;
  close (f);
  assign (f, fout);
  rewrite (f);
  for i := 1 to n do
    begin
      fillchar (bm, sizeof (bm), 0);
      if i = 1
        then dfs (2, i)
        else dfs (1, i);
      ok := false;
      for ii := 1 to n do
        if (ii <> i) and not bm[ii]
          then
            begin
              ok := true;
              break;
            end;
      if ok
        then write (f, i, ' ');
    end;
  close (f);
end.