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

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

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

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

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

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

d.q = l
d.y = l
d.p = l
d.r = j
h.o = l
h.t = l
k.w = h
k.v = d
l.p = k
l.o = d
j.t = k
j.v = k
j.y = h
j.q = d
j.z = d
assert d.r.q.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: D = None
        self.p: D = None
        self.r: E = None
        self.txt = txt

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

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

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

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

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

d.q = l
d.y = l
d.p = l
d.r = j
h.o = l
h.t = l
k.w = h
k.v = d
l.p = k
l.o = d
j.t = k
j.v = k
j.y = h
j.q = d
j.z = d
assert d.r.q.y.p.txt == "k"