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

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

c = A("c")
e = B("e")
g = A("g")
l = B("l")
h = B("h")

c.y = g
c.u = h
e.u = h
e.t = g
g.y = c
g.u = l
l.u = h
l.t = c
h.u = l
h.t = c
assert h.t.y.u.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.u: B = None
        self.txt = txt

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

c = A("c")
e = B("e")
g = A("g")
l = B("l")
h = B("h")

c.y = g
c.u = h
e.u = h
e.t = g
g.y = c
g.u = l
l.u = h
l.t = c
h.u = l
h.t = c
assert h.t.y.u.u.t.txt == "c"