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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: D = None
        self.txt = txt

h = A("h")
l = B("l")
g = C("g")
i = D("i")
a = E("a")
k = B("k")
j = A("j")
b = B("b")
e = E("e")

h.z = i
l.v = i
l.x = i
l.p = i
l.r = h
l.z = k
g.w = a
g.y = l
i.z = g
i.w = g
a.v = g
a.r = i
k.v = i
k.x = i
k.p = i
k.r = j
k.z = b
j.z = i
b.v = i
b.x = i
b.p = i
b.r = h
b.z = l
e.v = g
e.r = i
assert a.r.w.y.r.z.z.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: D = None
        self.txt = txt

h = A("h")
l = B("l")
g = C("g")
i = D("i")
a = E("a")
k = B("k")
j = A("j")
b = B("b")
e = E("e")

h.z = i
l.v = i
l.x = i
l.p = i
l.r = h
l.z = k
g.w = a
g.y = l
i.z = g
i.w = g
a.v = g
a.r = i
k.v = i
k.x = i
k.p = i
k.r = j
k.z = b
j.z = i
b.v = i
b.x = i
b.p = i
b.r = h
b.z = l
e.v = g
e.r = i
assert a.r.w.y.r.z.z.y.r.txt == "h"