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

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

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

h = A("h")
m = B("m")
g = C("g")
j = B("j")
l = C("l")
e = B("e")
b = B("b")
c = C("c")

h.s = m
m.u = j
m.r = l
g.s = l
g.x = h
g.u = b
j.u = b
j.r = g
l.s = c
l.x = h
l.u = m
e.u = b
e.r = l
b.u = m
b.r = c
c.s = l
c.x = h
c.u = m
assert g.u.u.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
g = C("g")
j = B("j")
l = C("l")
e = B("e")
b = B("b")
c = C("c")

h.s = m
m.u = j
m.r = l
g.s = l
g.x = h
g.u = b
j.u = b
j.r = g
l.s = c
l.x = h
l.u = m
e.u = b
e.r = l
b.u = m
b.r = c
c.s = l
c.x = h
c.u = m
assert g.u.u.u.u.r.txt == "c"