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

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

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

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

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

d = A("d")
l = B("l")
h = C("h")
c = D("c")
i = E("i")
j = B("j")

d.q = c
d.o = c
d.y = c
l.t = c
l.s = c
l.w = i
l.q = j
h.z = j
h.o = d
h.x = i
h.u = c
c.y = d
i.r = c
j.t = c
j.s = c
j.w = i
j.q = l
assert c.y.o.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

d = A("d")
l = B("l")
h = C("h")
c = D("c")
i = E("i")
j = B("j")

d.q = c
d.o = c
d.y = c
l.t = c
l.s = c
l.w = i
l.q = j
h.z = j
h.o = d
h.x = i
h.u = c
c.y = d
i.r = c
j.t = c
j.s = c
j.w = i
j.q = l
assert c.y.o.y.y.y.txt == "d"