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

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

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

h = A("h")
m = B("m")
i = C("i")
j = A("j")
k = C("k")
b = A("b")
g = B("g")
l = C("l")

h.u = m
h.z = g
h.s = i
m.x = g
m.y = k
i.q = h
i.w = j
i.y = g
j.u = g
j.z = m
j.s = l
k.q = h
k.w = j
k.y = g
b.u = g
b.z = m
b.s = l
g.x = m
g.y = k
l.q = j
l.w = b
l.y = m
assert h.z.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.s: C = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
i = C("i")
j = A("j")
k = C("k")
b = A("b")
g = B("g")
l = C("l")

h.u = m
h.z = g
h.s = i
m.x = g
m.y = k
i.q = h
i.w = j
i.y = g
j.u = g
j.z = m
j.s = l
k.q = h
k.w = j
k.y = g
b.u = g
b.z = m
b.s = l
g.x = m
g.y = k
l.q = j
l.w = b
l.y = m
assert h.z.x.x.x.txt == "m"