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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.txt = txt

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

j = A("j")
b = B("b")
l = C("l")
e = D("e")
f = B("f")
k = C("k")

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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.txt = txt

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

j = A("j")
b = B("b")
l = C("l")
e = D("e")
f = B("f")
k = C("k")

j.t = f
b.y = j
b.u = f
b.v = e
l.x = e
l.v = k
e.v = b
f.y = j
f.u = b
f.v = e
k.x = e
k.v = l
assert l.x.v.y.t.y.t.txt == "f"