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

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

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

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

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

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

g.w = m
g.x = m
g.r = l
l.u = k
l.q = k
l.r = e
l.z = e
l.y = m
e.q = m
k.y = g
k.w = l
k.z = l
k.v = m
m.v = g
m.t = g
assert g.w.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

g.w = m
g.x = m
g.r = l
l.u = k
l.q = k
l.r = e
l.z = e
l.y = m
e.q = m
k.y = g
k.w = l
k.z = l
k.v = m
m.v = g
m.t = g
assert g.w.t.x.t.txt == "g"