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

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

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

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

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

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

f.u = b
f.y = d
f.v = e
e.w = l
e.o = b
m.t = j
c.z = d
i.o = e
i.v = e
l.z = d
g.z = d
d.o = e
d.v = e
j.t = m
b.u = f
b.y = i
b.v = e
assert m.t.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: E = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

f.u = b
f.y = d
f.v = e
e.w = l
e.o = b
m.t = j
c.z = d
i.o = e
i.v = e
l.z = d
g.z = d
d.o = e
d.v = e
j.t = m
b.u = f
b.y = i
b.v = e
assert m.t.t.t.t.t.t.t.t.txt == "m"