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

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

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

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

d = A("d")
f = B("f")
b = C("b")
g = D("g")
h = B("h")
n = D("n")
c = B("c")
j = B("j")
e = B("e")

d.v = g
d.s = n
d.x = b
d.r = b
f.p = b
f.t = g
f.q = d
b.x = d
b.p = g
g.x = j
g.s = b
g.z = b
h.p = b
h.t = g
h.q = d
n.x = j
n.s = b
n.z = b
c.p = b
c.t = n
c.q = d
j.p = b
j.t = g
j.q = d
e.p = b
e.t = g
e.q = d
assert n.s.x.v.z.x.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: D = None
        self.x: C = None
        self.r: C = None
        self.txt = txt

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

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

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

d = A("d")
f = B("f")
b = C("b")
g = D("g")
h = B("h")
n = D("n")
c = B("c")
j = B("j")
e = B("e")

d.v = g
d.s = n
d.x = b
d.r = b
f.p = b
f.t = g
f.q = d
b.x = d
b.p = g
g.x = j
g.s = b
g.z = b
h.p = b
h.t = g
h.q = d
n.x = j
n.s = b
n.z = b
c.p = b
c.t = n
c.q = d
j.p = b
j.t = g
j.q = d
e.p = b
e.t = g
e.q = d
assert n.s.x.v.z.x.v.z.txt == "b"