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

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

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

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

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

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

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

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

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

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

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