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

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

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

e = A("e")
f = B("f")
a = C("a")
c = A("c")
n = C("n")
h = A("h")
j = B("j")
k = B("k")

e.s = a
e.p = a
f.y = n
f.z = c
f.w = k
a.y = c
c.s = n
c.p = n
n.y = c
h.s = n
h.p = n
j.y = n
j.z = h
j.w = f
k.y = a
k.z = h
k.w = f
assert a.y.s.y.p.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: C = None
        self.txt = txt

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

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

e = A("e")
f = B("f")
a = C("a")
c = A("c")
n = C("n")
h = A("h")
j = B("j")
k = B("k")

e.s = a
e.p = a
f.y = n
f.z = c
f.w = k
a.y = c
c.s = n
c.p = n
n.y = c
h.s = n
h.p = n
j.y = n
j.z = h
j.w = f
k.y = a
k.z = h
k.w = f
assert a.y.s.y.p.y.s.y.txt == "c"