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

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

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

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

n = A("n")
e = B("e")
g = C("g")
i = D("i")
j = D("j")
h = A("h")

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

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

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

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

n = A("n")
e = B("e")
g = C("g")
i = D("i")
j = D("j")
h = A("h")

n.z = g
n.o = j
e.r = h
e.t = h
e.q = n
g.s = n
g.u = j
i.v = j
i.u = j
i.x = g
i.s = g
j.v = i
j.u = i
j.x = g
j.s = g
h.z = g
h.o = j
assert i.s.s.z.s.z.s.txt == "n"