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

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

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

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

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

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

h.w = j
i.p = f
d.t = h
d.x = f
j.p = h
j.x = i
j.v = i
f.q = j
f.z = i
g.p = h
g.x = i
g.v = i
assert i.p.q.p.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

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

h.w = j
i.p = f
d.t = h
d.x = f
j.p = h
j.x = i
j.v = i
f.q = j
f.z = i
g.p = h
g.x = i
g.v = i
assert i.p.q.p.w.v.txt == "i"