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.v: B = None
        self.z: B = None
        self.txt = txt

c = A("c")
a = B("a")
f = B("f")
j = B("j")
k = B("k")
l = B("l")
d = A("d")
m = B("m")
h = A("h")

c.z = d
c.t = l
a.v = k
a.z = k
f.v = l
f.z = m
j.v = a
j.z = m
k.v = f
k.z = l
l.v = m
l.z = f
d.z = h
d.t = j
m.v = a
m.z = a
h.z = d
h.t = l
assert a.z.v.z.z.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.v: B = None
        self.z: B = None
        self.txt = txt

c = A("c")
a = B("a")
f = B("f")
j = B("j")
k = B("k")
l = B("l")
d = A("d")
m = B("m")
h = A("h")

c.z = d
c.t = l
a.v = k
a.z = k
f.v = l
f.z = m
j.v = a
j.z = m
k.v = f
k.z = l
l.v = m
l.z = f
d.z = h
d.t = j
m.v = a
m.z = a
h.z = d
h.t = l
assert a.z.v.z.z.txt == "a"