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

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

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

l = A("l")
b = B("b")
g = C("g")
f = B("f")
e = B("e")
j = B("j")
h = C("h")
m = A("m")
n = B("n")
d = C("d")

l.u = m
b.t = n
b.r = g
b.w = m
g.o = m
g.t = m
f.t = b
f.r = d
f.w = l
e.t = n
e.r = d
e.w = m
j.t = e
j.r = d
j.w = l
h.o = m
h.t = l
m.u = l
n.t = e
n.r = h
n.w = l
d.o = l
d.t = l
assert d.o.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
g = C("g")
f = B("f")
e = B("e")
j = B("j")
h = C("h")
m = A("m")
n = B("n")
d = C("d")

l.u = m
b.t = n
b.r = g
b.w = m
g.o = m
g.t = m
f.t = b
f.r = d
f.w = l
e.t = n
e.r = d
e.w = m
j.t = e
j.r = d
j.w = l
h.o = m
h.t = l
m.u = l
n.t = e
n.r = h
n.w = l
d.o = l
d.t = l
assert d.o.u.u.u.txt == "m"