class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: D = None
        self.s: E = None
        self.u: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

c.r = f
c.w = a
c.u = a
c.s = b
c.q = h
m.t = a
m.u = h
m.y = h
h.o = m
a.s = l
b.v = f
l.t = a
l.u = h
l.y = h
f.r = c
f.w = a
f.u = a
f.s = b
f.q = h
assert a.s.t.s.t.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.w: D = None
        self.s: E = None
        self.u: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

c.r = f
c.w = a
c.u = a
c.s = b
c.q = h
m.t = a
m.u = h
m.y = h
h.o = m
a.s = l
b.v = f
l.t = a
l.u = h
l.y = h
f.r = c
f.w = a
f.u = a
f.s = b
f.q = h
assert a.s.t.s.t.s.t.s.txt == "l"