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

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

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

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

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

k = A("k")
a = B("a")
d = C("d")
n = D("n")
e = E("e")
g = E("g")
b = D("b")

k.o = d
k.p = d
k.r = g
a.p = e
a.s = e
a.u = n
a.q = k
d.w = k
d.v = b
d.o = b
d.r = a
n.x = a
n.q = b
n.p = e
e.w = g
e.o = g
e.v = a
g.w = e
g.o = e
g.v = a
b.x = a
b.q = n
b.p = g
assert e.o.v.s.o.v.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

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

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

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

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

k = A("k")
a = B("a")
d = C("d")
n = D("n")
e = E("e")
g = E("g")
b = D("b")

k.o = d
k.p = d
k.r = g
a.p = e
a.s = e
a.u = n
a.q = k
d.w = k
d.v = b
d.o = b
d.r = a
n.x = a
n.q = b
n.p = e
e.w = g
e.o = g
e.v = a
g.w = e
g.o = e
g.v = a
b.x = a
b.q = n
b.p = g
assert e.o.v.s.o.v.q.p.txt == "d"