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

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

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

j = A("j")
k = B("k")
h = C("h")
l = C("l")
e = A("e")
d = C("d")
i = C("i")
c = A("c")
a = A("a")
m = B("m")

j.w = m
j.o = i
j.u = h
k.u = d
k.r = c
h.r = i
l.r = i
e.w = m
e.o = d
e.u = d
d.r = h
i.r = l
c.w = k
c.o = d
c.u = i
a.w = k
a.o = h
a.u = h
m.u = h
m.r = a
assert a.w.u.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: C = None
        self.u: C = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
h = C("h")
l = C("l")
e = A("e")
d = C("d")
i = C("i")
c = A("c")
a = A("a")
m = B("m")

j.w = m
j.o = i
j.u = h
k.u = d
k.r = c
h.r = i
l.r = i
e.w = m
e.o = d
e.u = d
d.r = h
i.r = l
c.w = k
c.o = d
c.u = i
a.w = k
a.o = h
a.u = h
m.u = h
m.r = a
assert a.w.u.r.r.txt == "i"