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

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

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

h = A("h")
n = B("n")
l = C("l")
a = C("a")
j = B("j")
g = B("g")

h.y = j
h.r = l
h.o = a
n.y = a
n.s = j
n.u = j
l.p = a
l.x = j
a.p = l
a.x = j
j.y = l
j.s = g
j.u = n
g.y = a
g.s = n
g.u = j
assert h.r.x.u.u.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
l = C("l")
a = C("a")
j = B("j")
g = B("g")

h.y = j
h.r = l
h.o = a
n.y = a
n.s = j
n.u = j
l.p = a
l.x = j
a.p = l
a.x = j
j.y = l
j.s = g
j.u = n
g.y = a
g.s = n
g.u = j
assert h.r.x.u.u.u.s.txt == "j"