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

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

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

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

c = A("c")
a = B("a")
e = C("e")
n = D("n")
h = B("h")
k = C("k")
d = B("d")
b = D("b")
f = A("f")
i = C("i")

c.y = n
c.s = b
c.q = b
c.v = f
a.r = b
a.q = b
a.z = f
a.s = n
e.x = i
e.s = i
e.t = c
e.q = f
n.y = e
n.t = b
n.s = d
n.z = f
h.r = b
h.q = b
h.z = c
h.s = n
k.x = e
k.t = f
k.q = f
k.s = i
d.r = n
d.q = n
d.z = c
d.s = b
b.y = i
b.t = n
b.s = a
b.z = c
f.y = n
f.s = n
f.q = b
f.v = c
i.x = k
i.t = f
i.q = f
i.s = e
assert b.s.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: D = None
        self.q: D = None
        self.v: A = None
        self.txt = txt

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

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

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

c = A("c")
a = B("a")
e = C("e")
n = D("n")
h = B("h")
k = C("k")
d = B("d")
b = D("b")
f = A("f")
i = C("i")

c.y = n
c.s = b
c.q = b
c.v = f
a.r = b
a.q = b
a.z = f
a.s = n
e.x = i
e.s = i
e.t = c
e.q = f
n.y = e
n.t = b
n.s = d
n.z = f
h.r = b
h.q = b
h.z = c
h.s = n
k.x = e
k.t = f
k.q = f
k.s = i
d.r = n
d.q = n
d.z = c
d.s = b
b.y = i
b.t = n
b.s = a
b.z = c
f.y = n
f.s = n
f.q = b
f.v = c
i.x = k
i.t = f
i.q = f
i.s = e
assert b.s.r.z.txt == "c"