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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: C = None
        self.s: A = None
        self.txt = txt

i = A("i")
h = B("h")
g = C("g")
c = B("c")
a = C("a")
l = A("l")

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

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

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: C = None
        self.s: A = None
        self.txt = txt

i = A("i")
h = B("h")
g = C("g")
c = B("c")
a = C("a")
l = A("l")

i.y = a
i.s = a
i.q = h
h.x = l
h.u = l
h.s = c
g.p = i
g.s = i
g.o = a
c.x = l
c.u = l
c.s = h
a.p = i
a.s = i
a.o = g
l.y = a
l.s = a
l.q = c
assert h.u.s.o.s.s.o.txt == "g"