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

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

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

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

h.v = b
h.t = b
h.z = b
j.x = b
j.z = f
b.v = k
b.t = h
b.q = f
l.x = b
l.z = e
f.v = b
f.t = b
f.z = b
m.x = b
m.z = f
d.x = b
d.z = e
i.x = b
i.z = k
k.v = b
k.t = b
k.z = b
e.v = b
e.t = b
e.z = b
assert h.t.q.v.t.z.q.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: C = None
        self.z: C = None
        self.txt = txt

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

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

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

h.v = b
h.t = b
h.z = b
j.x = b
j.z = f
b.v = k
b.t = h
b.q = f
l.x = b
l.z = e
f.v = b
f.t = b
f.z = b
m.x = b
m.z = f
d.x = b
d.z = e
i.x = b
i.z = k
k.v = b
k.t = b
k.z = b
e.v = b
e.t = b
e.z = b
assert h.t.q.v.t.z.q.t.t.txt == "h"