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

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

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

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

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

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

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

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

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

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

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