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

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

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

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

j = A("j")
l = B("l")
m = C("m")
d = D("d")
b = D("b")

j.o = b
j.u = b
j.q = b
j.t = d
l.w = j
l.u = j
m.w = j
m.o = j
d.z = m
d.y = l
d.w = l
d.v = b
b.z = m
b.y = l
b.w = l
b.v = d
assert j.t.z.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.u: D = None
        self.t: D = None
        self.q: D = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
m = C("m")
d = D("d")
b = D("b")

j.o = b
j.u = b
j.q = b
j.t = d
l.w = j
l.u = j
m.w = j
m.o = j
d.z = m
d.y = l
d.w = l
d.v = b
b.z = m
b.y = l
b.w = l
b.v = d
assert j.t.z.o.o.txt == "b"