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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: A = None
        self.x: A = None
        self.p: A = None
        self.v: A = None
        self.txt = txt

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

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

m.t = b
m.z = i
m.p = n
e.o = d
e.r = n
n.p = m
n.v = m
n.o = c
j.r = n
j.y = i
j.x = i
j.p = i
j.v = d
c.s = g
b.o = i
b.r = n
i.t = e
i.z = m
i.p = n
d.t = e
d.z = m
d.p = n
g.s = c
assert n.o.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: A = None
        self.x: A = None
        self.p: A = None
        self.v: A = None
        self.txt = txt

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

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

m.t = b
m.z = i
m.p = n
e.o = d
e.r = n
n.p = m
n.v = m
n.o = c
j.r = n
j.y = i
j.x = i
j.p = i
j.v = d
c.s = g
b.o = i
b.r = n
i.t = e
i.z = m
i.p = n
d.t = e
d.z = m
d.p = n
g.s = c
assert n.o.s.s.s.s.txt == "c"