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

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

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

h = A("h")
j = B("j")
f = C("f")
k = A("k")
l = B("l")
i = C("i")

h.s = i
h.p = k
h.o = l
j.z = f
j.p = f
f.w = l
k.s = i
k.p = h
k.o = j
l.z = i
l.p = i
i.w = l
assert k.s.w.z.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: A = None
        self.o: B = None
        self.txt = txt

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

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

h = A("h")
j = B("j")
f = C("f")
k = A("k")
l = B("l")
i = C("i")

h.s = i
h.p = k
h.o = l
j.z = f
j.p = f
f.w = l
k.s = i
k.p = h
k.o = j
l.z = i
l.p = i
i.w = l
assert k.s.w.z.w.p.txt == "i"