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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

m = A("m")
b = B("b")
n = C("n")
k = D("k")
d = E("d")
e = B("e")
c = A("c")
g = B("g")

m.u = d
b.u = n
n.x = g
n.u = e
n.y = e
n.o = d
k.q = c
d.t = n
d.x = m
d.u = m
d.z = e
d.p = k
e.u = n
c.u = d
g.u = n
assert m.u.x.u.u.u.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

m = A("m")
b = B("b")
n = C("n")
k = D("k")
d = E("d")
e = B("e")
c = A("c")
g = B("g")

m.u = d
b.u = n
n.x = g
n.u = e
n.y = e
n.o = d
k.q = c
d.t = n
d.x = m
d.u = m
d.z = e
d.p = k
e.u = n
c.u = d
g.u = n
assert m.u.x.u.u.u.t.u.u.txt == "n"