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

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

c = A("c")
f = B("f")
j = A("j")
b = B("b")
g = B("g")
n = B("n")
l = B("l")
e = A("e")
a = A("a")

c.y = b
c.x = n
f.u = j
f.t = a
j.y = l
j.x = b
b.u = e
b.t = e
g.u = j
g.t = e
n.u = a
n.t = j
l.u = e
l.t = c
e.y = n
e.x = f
a.y = n
a.x = n
assert a.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: B = None
        self.txt = txt

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

c = A("c")
f = B("f")
j = A("j")
b = B("b")
g = B("g")
n = B("n")
l = B("l")
e = A("e")
a = A("a")

c.y = b
c.x = n
f.u = j
f.t = a
j.y = l
j.x = b
b.u = e
b.t = e
g.u = j
g.t = e
n.u = a
n.t = j
l.u = e
l.t = c
e.y = n
e.x = f
a.y = n
a.x = n
assert a.y.t.y.txt == "l"