class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
k = C("k")
a = B("a")
d = C("d")
b = B("b")
l = A("l")
j = B("j")

i.q = l
i.r = h
i.z = a
h.z = b
h.v = b
k.s = d
k.p = l
k.r = a
a.z = b
a.v = j
d.s = k
d.p = l
d.r = j
b.z = h
b.v = h
l.q = i
l.r = h
l.z = h
j.z = b
j.v = h
assert a.z.z.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
k = C("k")
a = B("a")
d = C("d")
b = B("b")
l = A("l")
j = B("j")

i.q = l
i.r = h
i.z = a
h.z = b
h.v = b
k.s = d
k.p = l
k.r = a
a.z = b
a.v = j
d.s = k
d.p = l
d.r = j
b.z = h
b.v = h
l.q = i
l.r = h
l.z = h
j.z = b
j.v = h
assert a.z.z.z.v.z.txt == "b"