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

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

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

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

c = A("c")
e = B("e")
b = C("b")
i = D("i")
j = A("j")
l = B("l")
f = C("f")
d = D("d")

c.u = d
e.r = i
b.w = d
b.q = j
b.z = f
b.o = i
i.r = j
j.u = i
l.r = d
f.w = d
f.q = c
f.z = b
f.o = i
d.r = j
assert i.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
b = C("b")
i = D("i")
j = A("j")
l = B("l")
f = C("f")
d = D("d")

c.u = d
e.r = i
b.w = d
b.q = j
b.z = f
b.o = i
i.r = j
j.u = i
l.r = d
f.w = d
f.q = c
f.z = b
f.o = i
d.r = j
assert i.r.u.r.txt == "j"