Scanf.scanf "%d" (fun n ->
    let nei = Array.make n [] in
    for i = 1 to n - 1 do
        Scanf.scanf " %d %d" (fun a b ->
            let a = a - 1 in
            let b = b - 1 in
            nei.(a) <- b :: nei.(a);
            nei.(b) <- a :: nei.(b))
    done;
    let visited = Array.make n false in
    let rec find_shortest_way cur hist =
        if cur = 0 then hist else
            let rec loop = function
                | [] -> []
                | hd :: tl ->
                        if visited.(hd) then loop tl else
                            let () = visited.(hd) <- true in
                            let hist = find_shortest_way hd (hd :: hist) in
                            if hist = [] then loop tl else hist
            in
            loop nei.(cur)
    in
    visited.(n - 1) <- true;
    let hist = find_shortest_way (n - 1) [ n - 1 ] in
    let path = Array.of_list hist in
    let vis2 = Array.make n 0 in
    vis2.(0) <- 1;
    vis2.(n - 1) <- 2;
    let fill hist code =
        let rec loop f next = function
            | [] -> if next = [] then f else loop f [] next
            | hd :: tl -> (
                    let rec loop2 next f = function
                        | [] -> loop f next tl
                        | h :: t ->
                                if vis2.(h) = 0 then (vis2.(h) <- code; loop2 (h :: next) (f + 1) t)
                                                else loop2 next f t
                    in
                    loop2 next f nei.(hd)
           )
        in
        loop 0 [] hist
    in
    let step2 fenhist sunhist =
        let fens = List.length fenhist in
        let suns = List.length sunhist in
        let fens = fens + fill fenhist 1 in
        let suns = suns + fill sunhist 2 in
        print_endline @@ if fens <= suns then "Snuke" else "Fennec"
    in
    let rec loop fen sun fenhist sunhist turn =
        if turn then (
            let fen = fen + 1 in
            if fen = sun then step2 fenhist sunhist else
                let () = vis2.(path.(fen)) <- 1 in
                loop fen sun (path.(fen) :: fenhist) sunhist (not turn)
        ) else (
            let sun = sun - 1 in
            if fen = sun then step2 fenhist sunhist else
                let () = vis2.(path.(sun)) <- 2 in
                loop fen sun fenhist (path.(sun) :: sunhist) (not turn)
        )
    in
    let sun = Array.length path - 1 in
    loop 0 sun [ 0 ] [ n - 1 ] true
)
