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

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

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

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

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

k = A("k")
h = B("h")
i = C("i")
e = D("e")
d = E("d")
c = C("c")

k.v = h
k.r = h
h.q = k
h.t = k
h.z = k
h.x = i
i.p = e
i.x = c
i.z = d
i.w = d
e.p = c
d.v = e
c.p = e
c.x = i
c.z = d
c.w = d
assert d.v.p.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: B = None
        self.txt = txt

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

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

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

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

k = A("k")
h = B("h")
i = C("i")
e = D("e")
d = E("d")
c = C("c")

k.v = h
k.r = h
h.q = k
h.t = k
h.z = k
h.x = i
i.p = e
i.x = c
i.z = d
i.w = d
e.p = c
d.v = e
c.p = e
c.x = i
c.z = d
c.w = d
assert d.v.p.x.x.x.txt == "i"