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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: E = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

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

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

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

g.z = i
g.r = n
g.y = d
n.w = i
n.v = g
n.p = d
n.y = h
k.p = a
k.t = b
k.w = b
k.o = h
d.s = f
d.y = g
d.t = g
d.r = b
a.z = h
b.z = i
f.z = h
i.w = h
i.y = h
i.v = g
i.p = d
h.w = n
h.y = n
h.v = g
h.p = d
assert f.z.v.y.s.z.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: B = None
        self.y: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.t: E = None
        self.w: E = None
        self.o: B = None
        self.txt = txt

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

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

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

g.z = i
g.r = n
g.y = d
n.w = i
n.v = g
n.p = d
n.y = h
k.p = a
k.t = b
k.w = b
k.o = h
d.s = f
d.y = g
d.t = g
d.r = b
a.z = h
b.z = i
f.z = h
i.w = h
i.y = h
i.v = g
i.p = d
h.w = n
h.y = n
h.v = g
h.p = d
assert f.z.v.y.s.z.w.w.txt == "i"