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

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

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

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

e = A("e")
a = B("a")
c = C("c")
k = D("k")
b = A("b")
m = B("m")
n = D("n")
i = D("i")

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

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

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

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

e = A("e")
a = B("a")
c = C("c")
k = D("k")
b = A("b")
m = B("m")
n = D("n")
i = D("i")

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