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

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

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

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

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

n = A("n")
e = B("e")
a = C("a")
j = D("j")
m = E("m")
l = B("l")
b = E("b")

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

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

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

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

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

n = A("n")
e = B("e")
a = C("a")
j = D("j")
m = E("m")
l = B("l")
b = E("b")

n.r = l
n.s = l
e.w = l
e.x = n
a.r = e
a.q = l
a.o = m
a.u = n
j.o = a
j.x = a
j.z = n
m.v = n
m.o = j
m.u = e
l.w = e
l.x = n
b.v = n
b.o = j
b.u = l
assert l.w.x.r.w.x.txt == "n"