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

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

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

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

k.y = f
k.r = d
k.z = l
d.u = k
c.u = g
c.x = i
m.y = g
m.r = d
m.z = d
f.y = g
f.r = b
f.z = d
h.y = f
h.r = l
h.z = d
i.u = f
i.x = c
g.y = m
g.r = b
g.z = l
l.u = g
b.u = m
assert g.y.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

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

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

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

k.y = f
k.r = d
k.z = l
d.u = k
c.u = g
c.x = i
m.y = g
m.r = d
m.z = d
f.y = g
f.r = b
f.z = d
h.y = f
h.r = l
h.z = d
i.u = f
i.x = c
g.y = m
g.r = b
g.z = l
l.u = g
b.u = m
assert g.y.z.u.txt == "k"