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

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

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

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

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

f = A("f")
i = B("i")
e = C("e")
j = D("j")
g = E("g")
a = E("a")

f.p = j
f.x = e
f.y = e
i.r = j
i.w = a
e.v = f
e.u = g
e.y = a
e.t = j
j.x = e
j.y = g
j.u = a
j.p = a
j.z = f
g.r = a
g.p = j
a.r = g
a.p = j
assert i.w.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.x: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

f = A("f")
i = B("i")
e = C("e")
j = D("j")
g = E("g")
a = E("a")

f.p = j
f.x = e
f.y = e
i.r = j
i.w = a
e.v = f
e.u = g
e.y = a
e.t = j
j.x = e
j.y = g
j.u = a
j.p = a
j.z = f
g.r = a
g.p = j
a.r = g
a.p = j
assert i.w.p.z.txt == "f"