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

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

c = A("c")
g = B("g")
k = B("k")
j = B("j")
b = B("b")
e = B("e")
d = B("d")

c.u = j
g.t = c
k.t = c
j.t = c
b.t = c
e.t = c
d.t = c
assert g.t.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

c = A("c")
g = B("g")
k = B("k")
j = B("j")
b = B("b")
e = B("e")
d = B("d")

c.u = j
g.t = c
k.t = c
j.t = c
b.t = c
e.t = c
d.t = c
assert g.t.u.t.txt == "c"