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

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

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

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

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

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

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

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

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