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

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

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

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

f.w = e
f.p = l
f.x = h
b.t = h
b.p = e
j.z = f
j.r = f
j.s = l
e.z = f
e.r = f
e.s = j
l.z = f
l.r = f
l.s = j
h.t = i
h.p = e
i.t = h
i.p = l
assert h.p.r.x.t.t.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: C = None
        self.x: B = None
        self.txt = txt

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

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

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

f.w = e
f.p = l
f.x = h
b.t = h
b.p = e
j.z = f
j.r = f
j.s = l
e.z = f
e.r = f
e.s = j
l.z = f
l.r = f
l.s = j
h.t = i
h.p = e
i.t = h
i.p = l
assert h.p.r.x.t.t.t.p.txt == "l"