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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: B = None
        self.txt = txt

l = A("l")
c = B("c")
i = C("i")
f = D("f")
m = B("m")
k = D("k")
b = B("b")
j = D("j")

l.x = i
l.z = m
l.q = f
c.o = f
i.z = m
f.u = k
f.q = c
m.o = k
k.u = j
k.q = b
b.o = k
j.u = f
j.q = b
assert l.z.o.u.u.q.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: B = None
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: B = None
        self.txt = txt

l = A("l")
c = B("c")
i = C("i")
f = D("f")
m = B("m")
k = D("k")
b = B("b")
j = D("j")

l.x = i
l.z = m
l.q = f
c.o = f
i.z = m
f.u = k
f.q = c
m.o = k
k.u = j
k.q = b
b.o = k
j.u = f
j.q = b
assert l.z.o.u.u.q.o.q.txt == "c"