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

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

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

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

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

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

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

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

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