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

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

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

l = A("l")
c = B("c")
b = C("b")
f = A("f")
j = C("j")
d = A("d")
m = B("m")
a = B("a")
k = B("k")

l.v = f
c.z = a
c.q = f
b.y = k
f.v = d
j.y = c
d.v = f
m.z = a
m.q = d
a.z = k
a.q = f
k.z = c
k.q = f
assert l.v.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

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

l = A("l")
c = B("c")
b = C("b")
f = A("f")
j = C("j")
d = A("d")
m = B("m")
a = B("a")
k = B("k")

l.v = f
c.z = a
c.q = f
b.y = k
f.v = d
j.y = c
d.v = f
m.z = a
m.q = d
a.z = k
a.q = f
k.z = c
k.q = f
assert l.v.v.v.v.v.v.v.txt == "f"