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

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

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

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

i = A("i")
n = B("n")
h = C("h")
b = D("b")
e = A("e")
g = A("g")
k = B("k")
a = B("a")

i.w = g
i.x = e
i.z = n
i.p = h
n.y = h
n.x = h
n.s = k
h.w = e
h.v = a
h.r = n
h.s = k
b.r = a
b.q = h
b.p = n
e.w = i
e.x = g
e.z = n
e.p = h
g.w = e
g.x = i
g.z = a
g.p = h
k.y = h
k.x = h
k.s = n
a.y = h
a.x = h
a.s = n
assert i.z.x.r.x.v.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: A = None
        self.z: B = None
        self.p: C = None
        self.txt = txt

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

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

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

i = A("i")
n = B("n")
h = C("h")
b = D("b")
e = A("e")
g = A("g")
k = B("k")
a = B("a")

i.w = g
i.x = e
i.z = n
i.p = h
n.y = h
n.x = h
n.s = k
h.w = e
h.v = a
h.r = n
h.s = k
b.r = a
b.q = h
b.p = n
e.w = i
e.x = g
e.z = n
e.p = h
g.w = e
g.x = i
g.z = a
g.p = h
k.y = h
k.x = h
k.s = n
a.y = h
a.x = h
a.s = n
assert i.z.x.r.x.v.x.w.txt == "e"