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

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

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

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

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

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

e.r = d
e.w = j
e.q = g
i.p = b
i.r = b
g.s = e
g.u = e
g.z = d
j.q = b
j.s = b
d.t = g
d.v = g
d.z = e
b.r = d
b.w = j
b.q = g
assert e.w.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

e.r = d
e.w = j
e.q = g
i.p = b
i.r = b
g.s = e
g.u = e
g.z = d
j.q = b
j.s = b
d.t = g
d.v = g
d.z = e
b.r = d
b.w = j
b.q = g
assert e.w.q.q.txt == "g"