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

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

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

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

n = A("n")
m = B("m")
j = C("j")
k = D("k")
c = D("c")
i = D("i")
l = B("l")

n.o = l
n.z = j
n.p = j
n.q = i
m.q = j
m.r = j
m.t = l
j.o = k
j.w = n
j.p = n
j.z = c
k.s = l
k.z = j
k.x = j
c.s = l
c.z = j
c.x = j
i.s = l
i.z = j
i.x = j
l.q = j
l.r = j
l.t = m
assert n.p.z.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: C = None
        self.q: D = None
        self.p: C = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
j = C("j")
k = D("k")
c = D("c")
i = D("i")
l = B("l")

n.o = l
n.z = j
n.p = j
n.q = i
m.q = j
m.r = j
m.t = l
j.o = k
j.w = n
j.p = n
j.z = c
k.s = l
k.z = j
k.x = j
c.s = l
c.z = j
c.x = j
i.s = l
i.z = j
i.x = j
l.q = j
l.r = j
l.t = m
assert n.p.z.x.z.txt == "c"