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

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

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

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

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

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

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

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

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

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

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

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

i.u = k
i.p = k
i.w = h
i.y = j
d.p = f
d.t = k
d.z = k
d.v = i
h.r = k
k.z = i
k.o = i
f.v = i
f.z = h
j.r = k
assert d.v.w.r.txt == "k"