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

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

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

g = A("g")
a = B("a")
d = C("d")
m = C("m")
h = C("h")
j = C("j")
n = C("n")
l = B("l")
f = A("f")
c = C("c")

g.o = l
g.u = a
a.o = g
d.r = h
d.u = m
m.r = c
m.u = d
h.r = d
h.u = m
j.r = n
j.u = d
n.r = h
n.u = j
l.o = g
f.o = a
f.u = a
c.r = h
c.u = m
assert m.r.u.r.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

g = A("g")
a = B("a")
d = C("d")
m = C("m")
h = C("h")
j = C("j")
n = C("n")
l = B("l")
f = A("f")
c = C("c")

g.o = l
g.u = a
a.o = g
d.r = h
d.u = m
m.r = c
m.u = d
h.r = d
h.u = m
j.r = n
j.u = d
n.r = h
n.u = j
l.o = g
f.o = a
f.u = a
c.r = h
c.u = m
assert m.r.u.r.u.u.u.u.u.u.u.txt == "m"