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

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

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

h = A("h")
k = B("k")
j = C("j")
i = A("i")
m = C("m")
d = B("d")
g = C("g")
f = A("f")
n = C("n")

h.u = i
h.s = f
h.q = f
k.y = d
j.o = k
i.u = h
i.q = h
i.s = f
m.o = d
d.y = k
g.o = k
f.u = h
f.q = h
f.s = i
n.o = d
assert k.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.q: A = None
        self.txt = txt

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

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

h = A("h")
k = B("k")
j = C("j")
i = A("i")
m = C("m")
d = B("d")
g = C("g")
f = A("f")
n = C("n")

h.u = i
h.s = f
h.q = f
k.y = d
j.o = k
i.u = h
i.q = h
i.s = f
m.o = d
d.y = k
g.o = k
f.u = h
f.q = h
f.s = i
n.o = d
assert k.y.y.y.y.txt == "k"