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

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

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

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

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

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

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

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

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

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

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