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

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

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

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

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

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

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