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

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

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

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

k.s = b
k.u = i
k.y = a
d.y = b
d.q = k
m.u = b
m.s = c
g.s = l
g.u = a
g.y = a
a.u = g
a.s = e
e.y = l
e.q = b
c.y = g
c.q = g
l.s = b
l.u = m
l.y = i
i.u = l
i.s = c
b.s = l
b.u = i
b.y = i
assert d.q.y.u.u.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: C = None
        self.y: C = None
        self.txt = txt

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

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

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

k.s = b
k.u = i
k.y = a
d.y = b
d.q = k
m.u = b
m.s = c
g.s = l
g.u = a
g.y = a
a.u = g
a.s = e
e.y = l
e.q = b
c.y = g
c.q = g
l.s = b
l.u = m
l.y = i
i.u = l
i.s = c
b.s = l
b.u = i
b.y = i
assert d.q.y.u.u.s.y.txt == "l"