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

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

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

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

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

m = A("m")
k = B("k")
b = C("b")
l = D("l")
j = E("j")
g = B("g")

m.z = b
m.u = g
k.s = g
k.q = g
k.x = l
b.r = j
b.u = l
l.q = b
l.u = j
j.r = k
j.z = l
j.t = l
j.p = b
j.y = m
g.s = k
g.q = k
g.x = l
assert g.x.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

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

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

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

m = A("m")
k = B("k")
b = C("b")
l = D("l")
j = E("j")
g = B("g")

m.z = b
m.u = g
k.s = g
k.q = g
k.x = l
b.r = j
b.u = l
l.q = b
l.u = j
j.r = k
j.z = l
j.t = l
j.p = b
j.y = m
g.s = k
g.q = k
g.x = l
assert g.x.q.r.txt == "j"