class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.p: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

m.w = c
m.y = f
m.p = n
m.x = n
c.y = m
c.q = m
c.r = n
c.u = f
i.t = j
i.x = m
f.x = j
f.q = d
f.s = e
f.t = n
j.y = m
j.q = m
j.r = n
j.u = g
n.x = d
n.q = d
n.s = i
n.t = f
e.t = c
e.x = m
d.y = m
d.q = m
d.r = n
d.u = g
g.x = d
g.q = j
g.s = i
g.t = f
a.y = m
a.q = m
a.r = n
a.u = g
assert c.r.t.s.x.w.r.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: D = None
        self.p: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

m.w = c
m.y = f
m.p = n
m.x = n
c.y = m
c.q = m
c.r = n
c.u = f
i.t = j
i.x = m
f.x = j
f.q = d
f.s = e
f.t = n
j.y = m
j.q = m
j.r = n
j.u = g
n.x = d
n.q = d
n.s = i
n.t = f
e.t = c
e.x = m
d.y = m
d.q = m
d.r = n
d.u = g
g.x = d
g.q = j
g.s = i
g.t = f
a.y = m
a.q = m
a.r = n
a.u = g
assert c.r.t.s.x.w.r.t.t.txt == "n"