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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.x: B = None
        self.v: D = None
        self.txt = txt

f = A("f")
n = B("n")
g = C("g")
m = D("m")
k = E("k")
a = D("a")
l = E("l")
e = B("e")
d = E("d")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.x: B = None
        self.v: D = None
        self.txt = txt

f = A("f")
n = B("n")
g = C("g")
m = D("m")
k = E("k")
a = D("a")
l = E("l")
e = B("e")
d = E("d")

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