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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: B = None
        self.p: D = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: D = None
        self.v: D = None
        self.w: A = None
        self.txt = txt

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

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

j.r = c
j.o = a
d.t = b
d.o = k
d.p = f
d.z = j
a.x = j
a.w = j
a.s = m
a.v = m
f.t = k
f.q = j
b.t = k
b.q = j
k.t = b
k.o = c
k.p = m
k.z = j
g.t = m
g.p = m
g.o = c
g.z = j
n.x = j
n.w = j
n.s = m
n.v = f
m.t = k
m.q = j
c.t = b
c.o = d
c.p = f
c.z = j
assert m.t.o.z.o.s.t.p.q.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: B = None
        self.p: D = None
        self.z: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: D = None
        self.v: D = None
        self.w: A = None
        self.txt = txt

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

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

j.r = c
j.o = a
d.t = b
d.o = k
d.p = f
d.z = j
a.x = j
a.w = j
a.s = m
a.v = m
f.t = k
f.q = j
b.t = k
b.q = j
k.t = b
k.o = c
k.p = m
k.z = j
g.t = m
g.p = m
g.o = c
g.z = j
n.x = j
n.w = j
n.s = m
n.v = f
m.t = k
m.q = j
c.t = b
c.o = d
c.p = f
c.z = j
assert m.t.o.z.o.s.t.p.q.o.s.txt == "m"