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

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

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

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

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

c = A("c")
h = B("h")
g = C("g")
d = D("d")
l = E("l")
n = C("n")
f = D("f")

c.y = h
c.w = f
c.r = n
h.z = n
h.v = g
h.o = l
h.x = c
h.p = c
g.z = c
g.p = l
g.v = f
d.y = h
d.q = c
d.z = f
l.o = f
l.q = d
l.p = d
l.w = h
n.z = c
n.p = l
n.v = d
f.y = h
f.q = c
f.z = d
assert n.z.r.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: D = None
        self.r: C = None
        self.txt = txt

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

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

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

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

c = A("c")
h = B("h")
g = C("g")
d = D("d")
l = E("l")
n = C("n")
f = D("f")

c.y = h
c.w = f
c.r = n
h.z = n
h.v = g
h.o = l
h.x = c
h.p = c
g.z = c
g.p = l
g.v = f
d.y = h
d.q = c
d.z = f
l.o = f
l.q = d
l.p = d
l.w = h
n.z = c
n.p = l
n.v = d
f.y = h
f.q = c
f.z = d
assert n.z.r.z.y.txt == "h"