class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: E = None
        self.t: D = None
        self.r: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

b = A("b")
k = B("k")
c = C("c")
g = D("g")
j = E("j")
h = D("h")

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

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

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

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

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

b = A("b")
k = B("k")
c = C("c")
g = D("g")
j = E("j")
h = D("h")

b.s = j
b.o = j
b.t = h
b.r = c
b.z = c
k.q = c
k.r = j
c.w = k
c.v = k
c.z = b
c.r = g
g.q = k
g.x = k
g.w = c
g.o = h
j.z = b
h.q = k
h.x = k
h.w = c
h.o = g
assert g.o.q.r.z.o.txt == "j"