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

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

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

l = A("l")
h = B("h")
f = C("f")
k = C("k")
d = A("d")
m = C("m")
g = C("g")

l.t = d
l.w = g
h.z = g
h.s = d
f.y = h
f.p = h
f.t = k
k.y = h
k.p = h
k.t = g
d.t = l
d.w = k
m.y = h
m.p = h
m.t = g
g.y = h
g.p = h
g.t = m
assert l.w.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: C = None
        self.txt = txt

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

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

l = A("l")
h = B("h")
f = C("f")
k = C("k")
d = A("d")
m = C("m")
g = C("g")

l.t = d
l.w = g
h.z = g
h.s = d
f.y = h
f.p = h
f.t = k
k.y = h
k.p = h
k.t = g
d.t = l
d.w = k
m.y = h
m.p = h
m.t = g
g.y = h
g.p = h
g.t = m
assert l.w.t.y.txt == "h"