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

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

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

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

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

m = A("m")
g = B("g")
i = C("i")
l = D("l")
j = E("j")
f = A("f")

m.r = l
m.p = i
m.w = j
g.x = i
i.o = f
i.y = g
i.t = l
l.q = j
l.w = i
l.s = i
l.z = g
j.z = g
j.y = i
j.q = f
f.r = l
f.p = i
f.w = j
assert j.y.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: C = None
        self.w: E = None
        self.txt = txt

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

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

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

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

m = A("m")
g = B("g")
i = C("i")
l = D("l")
j = E("j")
f = A("f")

m.r = l
m.p = i
m.w = j
g.x = i
i.o = f
i.y = g
i.t = l
l.q = j
l.w = i
l.s = i
l.z = g
j.z = g
j.y = i
j.q = f
f.r = l
f.p = i
f.w = j
assert j.y.y.x.txt == "i"