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

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

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

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

m.w = n
m.x = j
m.u = f
e.p = n
h.u = b
h.x = i
b.u = h
b.x = h
i.u = h
i.x = b
n.u = i
n.x = i
l.p = h
j.p = n
f.w = b
f.x = l
f.u = m
d.w = b
d.x = l
d.u = f
assert n.x.x.u.u.u.u.x.u.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

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

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

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

m.w = n
m.x = j
m.u = f
e.p = n
h.u = b
h.x = i
b.u = h
b.x = h
i.u = h
i.x = b
n.u = i
n.x = i
l.p = h
j.p = n
f.w = b
f.x = l
f.u = m
d.w = b
d.x = l
d.u = f
assert n.x.x.u.u.u.u.x.u.u.x.txt == "i"