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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: E = None
        self.w: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

m.w = j
g.v = e
g.z = d
g.w = a
g.q = j
e.o = a
e.y = a
e.x = n
e.v = g
k.t = j
n.u = d
n.t = m
n.o = m
n.p = m
a.o = e
a.y = e
a.x = d
a.v = i
d.u = n
d.t = m
d.o = m
d.p = m
i.v = e
i.w = e
i.z = n
i.q = k
j.t = k
assert j.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: E = None
        self.w: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

m.w = j
g.v = e
g.z = d
g.w = a
g.q = j
e.o = a
e.y = a
e.x = n
e.v = g
k.t = j
n.u = d
n.t = m
n.o = m
n.p = m
a.o = e
a.y = e
a.x = d
a.v = i
d.u = n
d.t = m
d.o = m
d.p = m
i.v = e
i.w = e
i.z = n
i.q = k
j.t = k
assert j.t.t.t.t.t.t.t.txt == "k"