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

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

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

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

g.u = k
g.s = k
c.q = d
d.z = c
d.s = l
d.v = m
k.u = g
k.s = m
l.z = c
l.s = d
l.v = h
i.q = l
h.u = m
h.s = k
m.u = h
m.s = g
e.q = l
assert k.u.u.u.u.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.txt = txt

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

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

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

g.u = k
g.s = k
c.q = d
d.z = c
d.s = l
d.v = m
k.u = g
k.s = m
l.z = c
l.s = d
l.v = h
i.q = l
h.u = m
h.s = k
m.u = h
m.s = g
e.q = l
assert k.u.u.u.u.u.s.txt == "k"