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

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

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

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

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

n.u = i
n.x = i
n.t = m
c.r = n
c.s = i
e.v = d
e.y = j
e.q = m
e.o = n
i.p = j
i.u = n
i.z = c
j.p = i
j.u = n
j.z = c
m.v = e
m.y = i
m.q = d
m.o = n
d.v = e
d.y = i
d.q = m
d.o = n
assert i.p.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

n.u = i
n.x = i
n.t = m
c.r = n
c.s = i
e.v = d
e.y = j
e.q = m
e.o = n
i.p = j
i.u = n
i.z = c
j.p = i
j.u = n
j.z = c
m.v = e
m.y = i
m.q = d
m.o = n
d.v = e
d.y = i
d.q = m
d.o = n
assert i.p.z.s.txt == "i"