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

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

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

h = A("h")
i = B("i")
n = C("n")
f = B("f")
e = C("e")
j = C("j")
m = C("m")
a = A("a")

h.r = n
h.u = f
i.y = h
n.o = j
n.w = h
n.x = f
f.y = h
e.o = m
e.w = h
e.x = f
j.o = m
j.w = a
j.x = i
m.o = e
m.w = a
m.x = f
a.r = j
a.u = i
assert h.r.o.w.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.u: B = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
n = C("n")
f = B("f")
e = C("e")
j = C("j")
m = C("m")
a = A("a")

h.r = n
h.u = f
i.y = h
n.o = j
n.w = h
n.x = f
f.y = h
e.o = m
e.w = h
e.x = f
j.o = m
j.w = a
j.x = i
m.o = e
m.w = a
m.x = f
a.r = j
a.u = i
assert h.r.o.w.u.y.u.y.txt == "h"