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

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

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

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

h = A("h")
f = B("f")
l = C("l")
g = D("g")
a = C("a")
e = C("e")

h.u = l
h.v = f
h.q = e
f.s = h
f.x = h
f.p = l
l.q = h
l.u = g
l.t = f
g.z = a
a.q = h
a.u = g
a.t = f
e.q = h
e.u = g
e.t = f
assert a.u.z.u.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: B = None
        self.q: C = None
        self.txt = txt

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

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

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

h = A("h")
f = B("f")
l = C("l")
g = D("g")
a = C("a")
e = C("e")

h.u = l
h.v = f
h.q = e
f.s = h
f.x = h
f.p = l
l.q = h
l.u = g
l.t = f
g.z = a
a.q = h
a.u = g
a.t = f
e.q = h
e.u = g
e.t = f
assert a.u.z.u.z.t.txt == "f"