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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: D = None
        self.v: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: D = None
        self.v: E = None
        self.p: E = None
        self.txt = txt

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

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

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

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