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

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

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

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

a = A("a")
i = B("i")
d = C("d")
f = D("f")
h = D("h")
e = B("e")
b = C("b")

a.v = i
i.z = a
i.q = e
i.w = e
d.w = b
d.s = b
d.y = a
f.p = a
f.w = a
f.t = h
h.p = a
h.w = a
h.t = f
e.z = a
e.q = i
e.w = i
b.w = d
b.s = d
b.y = a
assert e.w.q.q.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

a = A("a")
i = B("i")
d = C("d")
f = D("f")
h = D("h")
e = B("e")
b = C("b")

a.v = i
i.z = a
i.q = e
i.w = e
d.w = b
d.s = b
d.y = a
f.p = a
f.w = a
f.t = h
h.p = a
h.w = a
h.t = f
e.z = a
e.q = i
e.w = i
b.w = d
b.s = d
b.y = a
assert e.w.q.q.z.v.txt == "i"