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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: E = None
        self.v: D = None
        self.z: A = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
m = C("m")
j = D("j")
e = E("e")
f = C("f")
b = E("b")
d = A("d")
n = C("n")

a.r = c
a.o = b
a.w = m
a.q = m
a.u = m
c.s = d
c.y = e
c.v = j
c.z = a
m.u = j
j.y = e
e.r = b
e.w = a
e.t = m
f.u = j
b.r = e
b.w = d
b.t = f
d.r = c
d.o = b
d.w = m
d.q = f
d.u = f
n.u = j
assert a.w.u.y.w.r.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: E = None
        self.w: C = None
        self.q: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: E = None
        self.v: D = None
        self.z: A = None
        self.txt = txt

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

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

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

a = A("a")
c = B("c")
m = C("m")
j = D("j")
e = E("e")
f = C("f")
b = E("b")
d = A("d")
n = C("n")

a.r = c
a.o = b
a.w = m
a.q = m
a.u = m
c.s = d
c.y = e
c.v = j
c.z = a
m.u = j
j.y = e
e.r = b
e.w = a
e.t = m
f.u = j
b.r = e
b.w = d
b.t = f
d.r = c
d.o = b
d.w = m
d.q = f
d.u = f
n.u = j
assert a.w.u.y.w.r.y.t.txt == "m"