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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

f.y = k
f.t = k
f.u = h
m.s = d
m.t = d
m.q = f
m.z = e
e.t = i
e.u = g
e.w = g
g.r = n
i.t = a
i.u = g
i.w = g
d.s = m
d.t = m
d.q = k
d.z = n
n.t = a
n.u = g
n.w = g
a.t = i
a.u = g
a.w = g
h.y = k
h.t = k
h.u = k
k.y = h
k.t = f
k.u = f
assert n.u.r.w.r.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: D = None
        self.w: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

f.y = k
f.t = k
f.u = h
m.s = d
m.t = d
m.q = f
m.z = e
e.t = i
e.u = g
e.w = g
g.r = n
i.t = a
i.u = g
i.w = g
d.s = m
d.t = m
d.q = k
d.z = n
n.t = a
n.u = g
n.w = g
a.t = i
a.u = g
a.w = g
h.y = k
h.t = k
h.u = k
k.y = h
k.t = f
k.u = f
assert n.u.r.w.r.t.t.txt == "i"