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

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

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

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

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

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

f.v = l
l.u = c
l.t = f
e.u = f
e.t = d
c.v = b
b.u = c
b.t = f
j.u = c
j.t = c
d.v = b
assert e.u.v.u.v.t.txt == "f"