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

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

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

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

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

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

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

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

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

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

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

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

e.v = f
e.w = f
e.x = g
e.q = g
e.p = a
g.r = a
f.v = g
f.x = g
f.o = c
f.p = k
c.s = g
c.x = e
a.o = e
k.v = g
k.x = g
k.o = c
k.p = f
assert e.p.o.w.o.s.r.txt == "a"