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

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

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

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

g = A("g")
h = B("h")
i = C("i")
m = D("m")
l = C("l")
f = B("f")
d = A("d")
n = C("n")
c = A("c")

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

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

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

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

g = A("g")
h = B("h")
i = C("i")
m = D("m")
l = C("l")
f = B("f")
d = A("d")
n = C("n")
c = A("c")

g.o = h
h.o = i
h.u = m
h.s = f
i.t = g
m.u = f
l.t = c
f.o = i
f.u = m
f.s = h
d.o = h
n.t = d
c.o = h
assert m.u.u.u.o.t.txt == "g"