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

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

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

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

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

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

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

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

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