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

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

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

f.z = b
f.u = l
j.t = k
j.v = a
c.t = m
c.v = f
e.z = a
e.u = a
l.z = e
l.u = a
b.z = e
b.u = e
a.z = e
a.u = b
m.t = k
m.v = f
d.t = k
d.v = f
k.t = d
k.v = a
assert m.v.u.u.z.z.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.u: A = None
        self.txt = txt

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

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

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