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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: D = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: D = None
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

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

b.v = e
b.x = e
b.z = e
e.z = i
a.t = b
a.z = i
a.q = e
a.y = e
n.z = b
i.z = b
f.z = b
h.t = b
h.z = i
h.q = e
h.y = e
g.z = b
assert f.z.v.z.z.v.z.txt == "i"