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

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

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

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

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

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

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

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

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

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

n.s = k
j.z = m
c.v = d
c.r = g
c.t = a
c.x = i
e.r = j
m.r = j
a.z = i
i.r = j
g.v = k
g.r = c
g.t = a
g.x = i
k.s = n
d.s = n
assert j.z.r.z.r.txt == "j"