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

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

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

c = A("c")
d = B("d")
k = C("k")
m = B("m")
j = C("j")
f = C("f")
l = B("l")
b = A("b")
g = A("g")
a = A("a")

c.s = a
d.o = k
d.u = j
k.p = f
k.o = f
m.o = k
m.u = k
j.p = k
j.o = f
f.p = k
f.o = j
l.o = k
l.u = f
b.s = a
g.s = a
a.s = b
assert a.s.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

c = A("c")
d = B("d")
k = C("k")
m = B("m")
j = C("j")
f = C("f")
l = B("l")
b = A("b")
g = A("g")
a = A("a")

c.s = a
d.o = k
d.u = j
k.p = f
k.o = f
m.o = k
m.u = k
j.p = k
j.o = f
f.p = k
f.o = j
l.o = k
l.u = f
b.s = a
g.s = a
a.s = b
assert a.s.s.s.s.s.s.s.s.txt == "a"