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

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

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

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

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

k = A("k")
a = B("a")
f = C("f")
d = D("d")
c = E("c")
e = E("e")

k.z = f
k.v = f
k.u = f
a.q = d
f.r = d
f.v = c
f.u = a
d.p = e
d.v = e
d.q = k
c.y = e
e.y = c
assert k.v.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.u: C = None
        self.txt = txt

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

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

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

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

k = A("k")
a = B("a")
f = C("f")
d = D("d")
c = E("c")
e = E("e")

k.z = f
k.v = f
k.u = f
a.q = d
f.r = d
f.v = c
f.u = a
d.p = e
d.v = e
d.q = k
c.y = e
e.y = c
assert k.v.u.q.txt == "d"