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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.t: E = None
        self.s: E = None
        self.txt = txt

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

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

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

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

g.r = l
g.x = e
k.u = f
k.t = f
k.s = f
k.y = g
e.y = g
l.w = f
l.q = f
l.u = k
l.s = e
f.q = l
f.v = l
f.w = g
assert k.y.x.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.t: E = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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