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

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

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

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

g.v = c
i.x = a
e.s = c
e.u = i
h.x = g
l.v = e
a.v = e
c.s = e
c.u = i
n.v = c
assert c.s.s.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

g.v = c
i.x = a
e.s = c
e.u = i
h.x = g
l.v = e
a.v = e
c.s = e
c.u = i
n.v = c
assert c.s.s.s.u.txt == "i"