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

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

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

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

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

k.v = b
k.u = b
k.w = l
k.s = f
g.z = l
g.w = l
g.o = f
g.v = b
b.s = l
b.r = g
l.v = g
l.s = g
l.z = f
l.x = f
f.v = g
f.s = g
f.z = l
f.x = l
assert g.o.z.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.s: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

k.v = b
k.u = b
k.w = l
k.s = f
g.z = l
g.w = l
g.o = f
g.v = b
b.s = l
b.r = g
l.v = g
l.s = g
l.z = f
l.x = f
f.v = g
f.s = g
f.z = l
f.x = l
assert g.o.z.s.o.txt == "f"