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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: C = None
        self.t: A = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: D = None
        self.s: D = None
        self.u: A = None
        self.txt = txt

g = A("g")
j = B("j")
b = C("b")
e = D("e")
a = E("a")

g.v = j
g.r = a
g.o = a
j.o = b
b.y = e
b.q = e
b.p = g
e.y = a
e.x = a
e.w = b
e.t = g
a.v = e
a.t = e
a.s = e
a.u = g
assert e.t.v.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: E = None
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.w: C = None
        self.t: A = None
        self.x: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: D = None
        self.s: D = None
        self.u: A = None
        self.txt = txt

g = A("g")
j = B("j")
b = C("b")
e = D("e")
a = E("a")

g.v = j
g.r = a
g.o = a
j.o = b
b.y = e
b.q = e
b.p = g
e.y = a
e.x = a
e.w = b
e.t = g
a.v = e
a.t = e
a.s = e
a.u = g
assert e.t.v.o.p.txt == "g"