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

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

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

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

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

m = A("m")
n = B("n")
c = C("c")
f = D("f")
h = E("h")
i = C("i")
a = E("a")
b = D("b")

m.x = h
m.s = b
n.v = h
n.u = m
n.p = c
n.w = a
c.y = m
c.z = f
f.o = m
f.w = a
f.p = h
f.s = c
h.t = a
i.y = m
i.z = f
a.t = h
b.o = m
b.w = a
b.p = h
b.s = c
assert m.x.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: D = None
        self.txt = txt

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

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

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

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

m = A("m")
n = B("n")
c = C("c")
f = D("f")
h = E("h")
i = C("i")
a = E("a")
b = D("b")

m.x = h
m.s = b
n.v = h
n.u = m
n.p = c
n.w = a
c.y = m
c.z = f
f.o = m
f.w = a
f.p = h
f.s = c
h.t = a
i.y = m
i.z = f
a.t = h
b.o = m
b.w = a
b.p = h
b.s = c
assert m.x.t.t.t.t.t.t.t.txt == "a"