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

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

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

i = A("i")
d = B("d")
f = C("f")
g = B("g")
m = C("m")
n = B("n")
l = B("l")
h = A("h")
e = B("e")
k = A("k")

i.w = k
i.z = l
d.y = h
d.u = h
d.w = m
f.v = i
f.p = n
f.r = k
g.y = i
g.u = k
g.w = f
m.v = h
m.r = h
m.p = l
n.y = k
n.u = i
n.w = f
l.y = i
l.u = i
l.w = m
h.w = i
h.z = l
e.y = k
e.u = k
e.w = m
k.w = h
k.z = d
assert n.y.z.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: B = None
        self.txt = txt

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

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

i = A("i")
d = B("d")
f = C("f")
g = B("g")
m = C("m")
n = B("n")
l = B("l")
h = A("h")
e = B("e")
k = A("k")

i.w = k
i.z = l
d.y = h
d.u = h
d.w = m
f.v = i
f.p = n
f.r = k
g.y = i
g.u = k
g.w = f
m.v = h
m.r = h
m.p = l
n.y = k
n.u = i
n.w = f
l.y = i
l.u = i
l.w = m
h.w = i
h.z = l
e.y = k
e.u = k
e.w = m
k.w = h
k.z = d
assert n.y.z.u.z.u.txt == "i"