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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

j = A("j")
i = B("i")
n = C("n")
c = D("c")
d = A("d")
h = C("h")
g = C("g")
l = B("l")
k = D("k")
b = D("b")

j.r = n
j.o = d
i.u = n
i.s = h
i.p = j
n.t = i
n.u = d
n.z = g
n.q = k
c.p = g
c.q = k
c.z = d
d.r = n
d.o = j
h.t = l
h.u = j
h.z = g
h.q = k
g.t = i
g.u = j
g.z = h
g.q = b
l.u = g
l.s = n
l.p = d
k.p = g
k.q = c
k.z = j
b.p = g
b.q = c
b.z = d
assert d.o.o.o.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: D = None
        self.z: A = None
        self.txt = txt

j = A("j")
i = B("i")
n = C("n")
c = D("c")
d = A("d")
h = C("h")
g = C("g")
l = B("l")
k = D("k")
b = D("b")

j.r = n
j.o = d
i.u = n
i.s = h
i.p = j
n.t = i
n.u = d
n.z = g
n.q = k
c.p = g
c.q = k
c.z = d
d.r = n
d.o = j
h.t = l
h.u = j
h.z = g
h.q = k
g.t = i
g.u = j
g.z = h
g.q = b
l.u = g
l.s = n
l.p = d
k.p = g
k.q = c
k.z = j
b.p = g
b.q = c
b.z = d
assert d.o.o.o.o.r.txt == "n"