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

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

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

a = A("a")
f = B("f")
e = C("e")
d = B("d")
c = C("c")
l = C("l")
i = C("i")
b = B("b")
h = A("h")
k = A("k")

a.u = l
a.x = h
a.z = h
f.x = d
f.y = b
f.w = k
e.u = h
e.w = k
d.x = b
d.y = f
d.w = k
c.u = a
c.w = k
l.u = k
l.w = k
i.u = h
i.w = a
b.x = d
b.y = d
b.w = h
h.u = l
h.x = a
h.z = k
k.u = c
k.x = h
k.z = a
assert f.y.w.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: A = None
        self.z: A = None
        self.txt = txt

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

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

a = A("a")
f = B("f")
e = C("e")
d = B("d")
c = C("c")
l = C("l")
i = C("i")
b = B("b")
h = A("h")
k = A("k")

a.u = l
a.x = h
a.z = h
f.x = d
f.y = b
f.w = k
e.u = h
e.w = k
d.x = b
d.y = f
d.w = k
c.u = a
c.w = k
l.u = k
l.w = k
i.u = h
i.w = a
b.x = d
b.y = d
b.w = h
h.u = l
h.x = a
h.z = k
k.u = c
k.x = h
k.z = a
assert f.y.w.u.u.txt == "k"