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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: B = None
        self.txt = txt

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

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

d = A("d")
c = B("c")
j = C("j")
n = D("n")
b = B("b")
h = C("h")
i = C("i")
e = D("e")
k = B("k")

d.u = e
d.z = j
c.t = d
c.x = k
j.x = c
n.z = e
n.w = e
n.o = i
b.t = d
b.x = c
h.x = k
i.x = c
e.z = n
e.w = n
e.o = j
k.t = d
k.x = c
assert j.x.x.x.x.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: B = None
        self.txt = txt

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

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

d = A("d")
c = B("c")
j = C("j")
n = D("n")
b = B("b")
h = C("h")
i = C("i")
e = D("e")
k = B("k")

d.u = e
d.z = j
c.t = d
c.x = k
j.x = c
n.z = e
n.w = e
n.o = i
b.t = d
b.x = c
h.x = k
i.x = c
e.z = n
e.w = n
e.o = j
k.t = d
k.x = c
assert j.x.x.x.x.t.z.txt == "j"