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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: B = None
        self.s: A = None
        self.z: A = None
        self.txt = txt

j = A("j")
e = B("e")
d = C("d")
m = D("m")
n = A("n")
a = D("a")
f = C("f")
l = B("l")

j.p = l
j.x = l
j.z = n
j.y = e
e.y = m
e.s = n
e.u = d
d.o = n
d.w = e
d.r = l
m.o = n
m.z = n
m.p = l
m.s = j
n.p = e
n.x = e
n.z = j
n.y = l
a.o = n
a.s = n
a.z = n
a.p = e
f.o = n
f.w = l
f.r = l
l.y = m
l.s = j
l.u = d
assert l.u.w.s.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.z: A = None
        self.y: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: B = None
        self.s: A = None
        self.z: A = None
        self.txt = txt

j = A("j")
e = B("e")
d = C("d")
m = D("m")
n = A("n")
a = D("a")
f = C("f")
l = B("l")

j.p = l
j.x = l
j.z = n
j.y = e
e.y = m
e.s = n
e.u = d
d.o = n
d.w = e
d.r = l
m.o = n
m.z = n
m.p = l
m.s = j
n.p = e
n.x = e
n.z = j
n.y = l
a.o = n
a.s = n
a.z = n
a.p = e
f.o = n
f.w = l
f.r = l
l.y = m
l.s = j
l.u = d
assert l.u.w.s.z.z.txt == "n"