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

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

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

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

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

k.z = a
c.w = d
c.x = i
d.s = c
j.x = e
j.y = c
j.z = c
j.w = g
g.w = d
g.x = e
b.w = d
b.x = e
a.z = k
e.x = i
e.y = c
e.z = g
e.w = g
i.x = e
i.y = b
i.z = g
i.w = c
assert g.x.z.x.x.w.w.s.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

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

k.z = a
c.w = d
c.x = i
d.s = c
j.x = e
j.y = c
j.z = c
j.w = g
g.w = d
g.x = e
b.w = d
b.x = e
a.z = k
e.x = i
e.y = c
e.z = g
e.w = g
i.x = e
i.y = b
i.z = g
i.w = c
assert g.x.z.x.x.w.w.s.x.y.txt == "b"