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

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

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

a = A("a")
l = B("l")
g = C("g")
b = A("b")
m = C("m")
n = B("n")
c = A("c")
h = B("h")
d = C("d")

a.s = h
l.t = n
g.o = h
g.w = b
g.u = d
b.s = n
m.o = l
m.w = c
m.u = d
n.t = l
c.s = l
h.t = l
d.o = n
d.w = b
d.u = m
assert g.w.s.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

a = A("a")
l = B("l")
g = C("g")
b = A("b")
m = C("m")
n = B("n")
c = A("c")
h = B("h")
d = C("d")

a.s = h
l.t = n
g.o = h
g.w = b
g.u = d
b.s = n
m.o = l
m.w = c
m.u = d
n.t = l
c.s = l
h.t = l
d.o = n
d.w = b
d.u = m
assert g.w.s.t.t.txt == "n"