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

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

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

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

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

b.s = n
b.z = h
b.y = f
e.w = a
e.y = k
h.z = e
n.y = g
n.t = g
n.q = a
k.y = n
k.t = n
k.q = a
c.z = e
a.w = e
a.y = g
f.w = e
f.y = n
l.s = g
l.z = c
l.y = a
g.y = n
g.t = n
g.q = e
assert g.y.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

b.s = n
b.z = h
b.y = f
e.w = a
e.y = k
h.z = e
n.y = g
n.t = g
n.q = a
k.y = n
k.t = n
k.q = a
c.z = e
a.w = e
a.y = g
f.w = e
f.y = n
l.s = g
l.z = c
l.y = a
g.y = n
g.t = n
g.q = e
assert g.y.y.q.txt == "e"