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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: C = None
        self.o: C = None
        self.u: D = None
        self.txt = txt

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

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

l.r = m
l.u = m
l.o = g
b.p = a
b.r = n
g.y = l
g.z = e
g.o = e
g.u = n
m.r = f
m.t = n
m.x = d
n.r = d
n.t = m
n.x = b
i.y = l
i.z = a
i.o = g
i.u = n
d.p = g
d.r = n
f.p = a
f.r = m
a.y = l
a.z = i
a.o = e
a.u = m
e.y = l
e.z = a
e.o = g
e.u = m
assert m.x.p.u.r.p.y.o.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: C = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: C = None
        self.o: C = None
        self.u: D = None
        self.txt = txt

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

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

l.r = m
l.u = m
l.o = g
b.p = a
b.r = n
g.y = l
g.z = e
g.o = e
g.u = n
m.r = f
m.t = n
m.x = d
n.r = d
n.t = m
n.x = b
i.y = l
i.z = a
i.o = g
i.u = n
d.p = g
d.r = n
f.p = a
f.r = m
a.y = l
a.z = i
a.o = e
a.u = m
e.y = l
e.z = a
e.o = g
e.u = m
assert m.x.p.u.r.p.y.o.u.t.txt == "m"