class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.p: E = None
        self.w: C = None
        self.txt = txt

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

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

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

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

d = A("d")
n = B("n")
j = C("j")
b = D("b")
k = E("k")

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

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

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

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

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

d = A("d")
n = B("n")
j = C("j")
b = D("b")
k = E("k")

d.y = j
d.w = j
d.p = k
n.y = j
n.z = k
j.t = b
j.u = b
j.o = k
j.v = d
b.r = n
b.q = k
k.p = j
assert b.r.z.p.v.p.txt == "k"