
{$R-,Q-}

program Walls_Problem;

const
  name1         =           'walls.in';
  name2         =           'walls.out';
  maxM          =           200;
  maxN          =           250;

type
  TarrN         =           array[1..maxN] of byte;
  TarrM         =           array[1..maxM] of integer;

var
  M, N, L       :           integer;
  wall          :           array[1..maxN] of ^TarrN;
  belong        :           array[1..30] of set of byte;
  mark          :           array[1..maxN] of byte;
  Dy            :           array[1..maxM] of ^TarrM;

  ansRegion     :           integer;
  ansDis        :           longint;

procedure init;
var inf : text;
    i, j, k, a, b   : integer;
    circle : array[1..maxN+1] of integer;
begin
  assign(inf, name1); reset(inf);
  readln(inf, M, N, L);

  fillchar(belong, sizeof(belong), 0);
  fillchar(mark, sizeof(mark), 0);

  for i := 1 to L do
    begin
      read(inf, j);
      mark[j] := i;
    end;

  for i := 1 to N do
    begin
      new(wall[i]);
      fillchar(wall[i]^, sizeof(wall[i]^), 0);
    end;

  for i := 1 to M do
    begin
      new(Dy[i]);
      fillchar(Dy[i]^, sizeof(Dy[i]^), 0);
    end;

  for i := 1 to M do
    begin
      readln(inf, j);
      for k := 1 to j do read(inf, circle[k]);
      circle[j+1] := circle[1];
      for k := 1 to j do
        begin
          a := circle[k];
          b := circle[k+1];
          if wall[a]^[b] = 0
            then wall[a]^[b] := i
            else wall[b]^[a] := i;
          if mark[a] > 0 then
            include(belong[ mark[a] ], i);
        end;
    end;

  for i := 1 to N do
    for j := 1 to N do
      if (wall[i]^[j] > 0) and (wall[j]^[i] > 0) then
        begin
          Dy[ wall[i]^[j] ]^[ wall[j]^[i] ] := 1;
          Dy[ wall[j]^[i] ]^[ wall[i]^[j] ] := 1;
        end;

  close(inf);
end;

procedure main;
var i, j, k, min : integer;
    thisDis      : longint;
begin
  ansDis := maxLongInt;

  for i := 1 to M do
    for j := 1 to M do
      if (i <> j) and (Dy[i]^[j] = 0) then
        Dy[i]^[j] := -1;

  for k := 1 to M do
    for i := 1 to M do
      if Dy[i]^[k] <> -1 then
        for j := 1 to M do
          if Dy[k]^[j] <> -1 then
             if (Dy[i]^[j] = -1) or (Dy[i]^[j] > Dy[i]^[k] + Dy[k]^[j]) then
               Dy[i]^[j] := Dy[i]^[k] + Dy[k]^[j];

  for i := 1 to M do
    begin
      thisDis := 0;
      for j := 1 to L do
        begin
          min := maxint;
          for k := 1 to M do
            if (k in belong[j]) and (Dy[k]^[i] < min) then
              min := Dy[k]^[i];
          inc(thisDis, min);
        end;
      if thisDis < ansDis then
        begin
          ansDis := thisDis;
          ansRegion := i;
        end;
    end;
end;

procedure out;
var ouf : text;
begin
  assign(ouf, name2);
  rewrite(ouf);
  writeln(ouf, ansDis);
  writeln(ouf, ansRegion);
  close(ouf);
end;

begin
  init;
  main;
  out;
end.
