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

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

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

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

f = A("f")
a = B("a")
b = C("b")
c = D("c")
k = B("k")
n = D("n")
h = B("h")
i = A("i")

f.w = n
f.q = n
f.v = i
f.y = c
a.s = b
a.t = n
a.z = f
b.o = h
b.v = f
c.p = b
c.v = b
c.s = b
c.r = i
k.s = b
k.t = n
k.z = i
n.p = b
n.v = b
n.s = b
n.r = f
h.s = b
h.t = n
h.z = f
i.w = c
i.y = c
i.q = c
i.v = f
assert c.p.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: A = None
        self.y: D = None
        self.q: D = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
b = C("b")
c = D("c")
k = B("k")
n = D("n")
h = B("h")
i = A("i")

f.w = n
f.q = n
f.v = i
f.y = c
a.s = b
a.t = n
a.z = f
b.o = h
b.v = f
c.p = b
c.v = b
c.s = b
c.r = i
k.s = b
k.t = n
k.z = i
n.p = b
n.v = b
n.s = b
n.r = f
h.s = b
h.t = n
h.z = f
i.w = c
i.y = c
i.q = c
i.v = f
assert c.p.v.y.txt == "c"