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

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

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

e = A("e")
m = B("m")
f = C("f")
h = A("h")
b = A("b")
a = A("a")
d = B("d")

e.t = d
e.p = f
m.z = f
f.v = h
f.x = m
f.s = b
h.t = d
h.p = f
b.t = m
b.p = f
a.t = m
a.p = f
d.z = f
assert a.t.z.s.p.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.p: C = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
f = C("f")
h = A("h")
b = A("b")
a = A("a")
d = B("d")

e.t = d
e.p = f
m.z = f
f.v = h
f.x = m
f.s = b
h.t = d
h.p = f
b.t = m
b.p = f
a.t = m
a.p = f
d.z = f
assert a.t.z.s.p.v.p.txt == "f"