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

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

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

l = A("l")
g = B("g")
n = C("n")
h = A("h")
j = B("j")
c = C("c")
m = A("m")
k = C("k")

l.o = h
l.s = g
l.y = n
g.s = l
g.q = m
g.y = c
n.u = g
h.o = l
h.s = g
h.y = k
j.s = h
j.q = h
j.y = k
c.u = j
m.o = l
m.s = j
m.y = n
k.u = g
assert j.y.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: B = None
        self.y: C = None
        self.txt = txt

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

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

l = A("l")
g = B("g")
n = C("n")
h = A("h")
j = B("j")
c = C("c")
m = A("m")
k = C("k")

l.o = h
l.s = g
l.y = n
g.s = l
g.q = m
g.y = c
n.u = g
h.o = l
h.s = g
h.y = k
j.s = h
j.q = h
j.y = k
c.u = j
m.o = l
m.s = j
m.y = n
k.u = g
assert j.y.u.y.u.y.txt == "k"