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

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

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

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

f = A("f")
k = B("k")
i = C("i")
j = D("j")
b = C("b")
c = C("c")
g = B("g")

f.w = g
k.v = j
k.u = g
k.z = b
i.v = f
i.s = g
j.o = f
b.v = f
b.s = k
c.v = f
c.s = k
g.v = j
g.u = k
g.z = c
assert k.z.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

f = A("f")
k = B("k")
i = C("i")
j = D("j")
b = C("b")
c = C("c")
g = B("g")

f.w = g
k.v = j
k.u = g
k.z = b
i.v = f
i.s = g
j.o = f
b.v = f
b.s = k
c.v = f
c.s = k
g.v = j
g.u = k
g.z = c
assert k.z.s.v.txt == "j"