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

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

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

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

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

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

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

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

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

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

m.x = f
m.s = n
m.u = l
m.p = d
n.q = f
n.x = d
n.y = m
n.z = a
l.o = f
f.y = a
f.u = d
f.z = d
a.o = f
d.x = f
d.s = n
d.u = l
d.p = m
assert l.o.y.o.z.u.txt == "l"