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

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

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

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

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

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

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

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

b.y = a
b.s = c
g.o = l
d.z = l
d.p = e
d.s = k
k.z = d
k.p = f
k.s = l
f.o = k
j.o = k
a.y = c
a.s = b
c.y = b
c.s = a
e.o = l
l.z = d
l.p = j
l.s = k
assert d.s.s.z.z.s.s.z.txt == "d"