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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: B = None
        self.u: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: B = None
        self.o: B = None
        self.r: C = None
        self.txt = txt

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

c = A("c")
k = B("k")
g = C("g")
d = D("d")
j = E("j")

c.q = j
k.x = c
k.w = g
k.o = j
g.p = d
g.u = d
g.y = k
d.p = j
d.z = k
d.o = k
d.r = g
j.o = d
j.v = d
j.w = c
assert k.o.v.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: B = None
        self.u: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: B = None
        self.o: B = None
        self.r: C = None
        self.txt = txt

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

c = A("c")
k = B("k")
g = C("g")
d = D("d")
j = E("j")

c.q = j
k.x = c
k.w = g
k.o = j
g.p = d
g.u = d
g.y = k
d.p = j
d.z = k
d.o = k
d.r = g
j.o = d
j.v = d
j.w = c
assert k.o.v.r.u.txt == "d"