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

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

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

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

k = A("k")
f = B("f")
i = C("i")
h = D("h")
e = B("e")
l = A("l")
m = C("m")
b = C("b")

k.s = l
f.q = e
f.x = e
f.p = e
f.u = i
i.o = e
i.w = l
i.v = f
i.t = b
h.z = i
e.q = f
e.x = f
e.p = f
e.u = i
l.s = k
m.o = f
m.v = f
m.w = l
m.t = i
b.o = e
b.w = l
b.v = f
b.t = m
assert h.z.v.q.u.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.txt = txt

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

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

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

k = A("k")
f = B("f")
i = C("i")
h = D("h")
e = B("e")
l = A("l")
m = C("m")
b = C("b")

k.s = l
f.q = e
f.x = e
f.p = e
f.u = i
i.o = e
i.w = l
i.v = f
i.t = b
h.z = i
e.q = f
e.x = f
e.p = f
e.u = i
l.s = k
m.o = f
m.v = f
m.w = l
m.t = i
b.o = e
b.w = l
b.v = f
b.t = m
assert h.z.v.q.u.o.q.txt == "f"