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

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

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

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

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

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

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

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

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