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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.v: C = None
        self.w: D = None
        self.x: E = None
        self.txt = txt

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

k.u = e
k.v = e
k.w = c
k.s = m
k.z = l
n.o = d
c.t = b
e.y = n
e.s = n
e.t = c
e.q = c
d.t = m
d.o = m
d.v = c
d.w = e
d.x = b
m.t = b
l.u = e
l.v = e
l.w = m
l.s = c
l.z = k
b.t = m
b.v = m
b.o = c
b.w = e
b.x = d
assert m.t.t.t.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: D = None
        self.w: C = None
        self.s: C = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: C = None
        self.v: C = None
        self.w: D = None
        self.x: E = None
        self.txt = txt

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

k.u = e
k.v = e
k.w = c
k.s = m
k.z = l
n.o = d
c.t = b
e.y = n
e.s = n
e.t = c
e.q = c
d.t = m
d.o = m
d.v = c
d.w = e
d.x = b
m.t = b
l.u = e
l.v = e
l.w = m
l.s = c
l.z = k
b.t = m
b.v = m
b.o = c
b.w = e
b.x = d
assert m.t.t.t.w.t.txt == "c"