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

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

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

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

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

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

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

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

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

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

k.z = i
k.t = h
e.y = k
m.v = a
m.t = a
m.s = a
m.q = e
g.t = b
g.q = h
i.z = k
i.t = a
h.y = k
l.z = k
l.t = e
a.y = k
b.t = g
b.q = a
assert h.y.t.y.txt == "k"