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

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

f = A("f")
n = B("n")
a = A("a")
l = B("l")
c = A("c")

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

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

f = A("f")
n = B("n")
a = A("a")
l = B("l")
c = A("c")

f.x = l
n.x = l
n.u = l
a.x = l
l.x = n
l.u = n
c.x = l
assert f.x.u.x.u.u.txt == "l"