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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.t: A = None
        self.txt = txt

l = A("l")
m = B("m")
e = C("e")
f = A("f")
d = A("d")
h = B("h")
g = B("g")
c = A("c")

l.w = m
l.s = e
l.u = e
m.q = g
e.r = h
e.x = m
e.t = l
f.w = g
f.s = e
f.u = e
d.w = m
d.s = e
d.u = e
h.q = g
g.q = m
c.w = m
c.s = e
c.u = e
assert m.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: C = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.t: A = None
        self.txt = txt

l = A("l")
m = B("m")
e = C("e")
f = A("f")
d = A("d")
h = B("h")
g = B("g")
c = A("c")

l.w = m
l.s = e
l.u = e
m.q = g
e.r = h
e.x = m
e.t = l
f.w = g
f.s = e
f.u = e
d.w = m
d.s = e
d.u = e
h.q = g
g.q = m
c.w = m
c.s = e
c.u = e
assert m.q.q.q.q.q.q.txt == "m"