let l1:int list ref ref ref = ref (ref (ref []))
let l: int list ref = ref !(!(!l1))

let ref (a:int) : unit = print_int a ; print_newline ()
let rec f (a:int) : unit = if a>0 then (ref a ; l := a::!l ; f (a-1))
let rec g (a:int list) : unit = match a with [] -> () | x::s -> ref x ; g s

let () = l := 42 :: !l ; f 10 ; print_newline () ; g !l
