class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: A = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.txt = txt

l = A("l")
h = B("h")
f = C("f")
j = B("j")
n = A("n")
i = C("i")
k = A("k")
c = A("c")
b = B("b")
a = A("a")

l.x = a
h.p = i
h.v = k
h.t = f
f.v = b
f.p = b
j.p = i
j.v = n
j.t = f
n.x = k
i.v = b
i.p = h
k.x = n
c.x = l
b.p = f
b.v = l
b.t = i
a.x = c
assert k.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: A = None
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.txt = txt

l = A("l")
h = B("h")
f = C("f")
j = B("j")
n = A("n")
i = C("i")
k = A("k")
c = A("c")
b = B("b")
a = A("a")

l.x = a
h.p = i
h.v = k
h.t = f
f.v = b
f.p = b
j.p = i
j.v = n
j.t = f
n.x = k
i.v = b
i.p = h
k.x = n
c.x = l
b.p = f
b.v = l
b.t = i
a.x = c
assert k.x.x.x.x.x.txt == "n"