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

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

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

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

a = A("a")
n = B("n")
c = C("c")
m = D("m")
l = D("l")
j = C("j")
k = A("k")

a.x = n
a.t = c
n.o = l
n.u = j
c.q = j
c.x = j
c.o = n
m.y = c
l.y = j
j.q = c
j.x = c
j.o = n
k.x = n
k.t = j
assert k.x.o.y.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: C = None
        self.txt = txt

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

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

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

a = A("a")
n = B("n")
c = C("c")
m = D("m")
l = D("l")
j = C("j")
k = A("k")

a.x = n
a.t = c
n.o = l
n.u = j
c.q = j
c.x = j
c.o = n
m.y = c
l.y = j
j.q = c
j.x = c
j.o = n
k.x = n
k.t = j
assert k.x.o.y.o.u.txt == "j"