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

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

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

h = A("h")
i = B("i")
c = C("c")
b = B("b")
m = A("m")
f = B("f")
a = C("a")
n = C("n")
d = C("d")
g = A("g")

h.u = m
i.z = g
c.y = i
c.u = n
c.z = m
b.z = m
m.u = h
f.z = g
a.y = i
a.u = c
a.z = m
n.y = f
n.u = d
n.z = m
d.y = f
d.u = c
d.z = h
g.u = m
assert h.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
c = C("c")
b = B("b")
m = A("m")
f = B("f")
a = C("a")
n = C("n")
d = C("d")
g = A("g")

h.u = m
i.z = g
c.y = i
c.u = n
c.z = m
b.z = m
m.u = h
f.z = g
a.y = i
a.u = c
a.z = m
n.y = f
n.u = d
n.z = m
d.y = f
d.u = c
d.z = h
g.u = m
assert h.u.u.u.u.txt == "h"