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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

f = A("f")
e = B("e")
i = C("i")
n = D("n")
c = A("c")
j = C("j")
l = A("l")

f.v = l
f.s = l
f.u = c
f.w = c
e.x = n
e.s = i
i.y = j
n.v = j
n.z = e
c.v = f
c.s = f
c.w = f
c.u = l
j.y = i
l.v = f
l.u = f
l.s = c
l.w = c
assert l.w.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.s: A = None
        self.w: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

f = A("f")
e = B("e")
i = C("i")
n = D("n")
c = A("c")
j = C("j")
l = A("l")

f.v = l
f.s = l
f.u = c
f.w = c
e.x = n
e.s = i
i.y = j
n.v = j
n.z = e
c.v = f
c.s = f
c.w = f
c.u = l
j.y = i
l.v = f
l.u = f
l.s = c
l.w = c
assert l.w.u.v.txt == "f"