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

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

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

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

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

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

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

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

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

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

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

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

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