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

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

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

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

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

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

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

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

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

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

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

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

k.p = g
k.r = l
k.w = i
b.o = l
b.y = i
b.s = k
b.v = g
c.q = f
c.z = a
i.p = h
i.v = h
i.x = h
i.r = h
i.o = k
h.x = l
h.q = g
h.w = c
h.p = f
f.q = c
f.z = g
a.o = k
a.y = i
a.s = l
a.v = g
g.o = l
g.y = i
g.s = k
g.v = b
l.p = b
l.r = k
l.w = i
assert f.z.o.p.s.w.o.txt == "k"