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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: C = None
        self.q: A = None
        self.p: C = None
        self.v: E = None
        self.txt = txt

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

c = A("c")
k = B("k")
e = C("e")
f = D("f")
j = E("j")
a = A("a")
h = C("h")
g = B("g")

c.w = k
c.r = f
c.y = a
c.p = j
k.w = g
k.x = j
e.q = c
e.p = c
e.s = f
e.z = k
f.z = h
f.p = h
f.y = e
f.q = c
f.v = j
j.y = k
a.w = k
a.r = f
a.y = c
a.p = j
h.q = c
h.p = a
h.s = f
h.z = g
g.w = k
g.x = j
assert h.p.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: D = None
        self.y: A = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: C = None
        self.q: A = None
        self.p: C = None
        self.v: E = None
        self.txt = txt

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

c = A("c")
k = B("k")
e = C("e")
f = D("f")
j = E("j")
a = A("a")
h = C("h")
g = B("g")

c.w = k
c.r = f
c.y = a
c.p = j
k.w = g
k.x = j
e.q = c
e.p = c
e.s = f
e.z = k
f.z = h
f.p = h
f.y = e
f.q = c
f.v = j
j.y = k
a.w = k
a.r = f
a.y = c
a.p = j
h.q = c
h.p = a
h.s = f
h.z = g
g.w = k
g.x = j
assert h.p.p.y.txt == "k"