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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.txt = txt

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

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

l.t = e
c.y = f
c.z = i
n.q = i
n.v = f
f.y = c
f.z = n
b.t = k
h.t = i
j.t = e
e.q = i
e.v = c
k.q = i
k.v = f
i.q = n
i.v = f
assert f.y.z.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.txt = txt

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

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

l.t = e
c.y = f
c.z = i
n.q = i
n.v = f
f.y = c
f.z = n
b.t = k
h.t = i
j.t = e
e.q = i
e.v = c
k.q = i
k.v = f
i.q = n
i.v = f
assert f.y.z.q.q.txt == "i"