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

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

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

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

l = A("l")
k = B("k")
f = C("f")
j = D("j")
g = D("g")
a = B("a")
e = B("e")
c = B("c")

l.q = f
k.w = l
k.z = l
k.p = l
f.q = l
f.o = l
j.r = g
j.s = f
g.r = j
g.s = f
a.w = l
a.z = l
a.p = l
e.w = l
e.z = l
e.p = l
c.w = l
c.z = l
c.p = l
assert f.o.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

l = A("l")
k = B("k")
f = C("f")
j = D("j")
g = D("g")
a = B("a")
e = B("e")
c = B("c")

l.q = f
k.w = l
k.z = l
k.p = l
f.q = l
f.o = l
j.r = g
j.s = f
g.r = j
g.s = f
a.w = l
a.z = l
a.p = l
e.w = l
e.z = l
e.p = l
c.w = l
c.z = l
c.p = l
assert f.o.q.q.txt == "l"