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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: B = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

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

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

d.t = g
d.s = g
d.w = f
f.v = c
f.w = k
f.z = g
f.x = g
k.p = g
k.w = c
k.y = f
k.z = d
g.y = c
g.s = d
g.w = d
c.v = f
c.w = i
c.z = g
c.x = g
i.p = g
i.w = c
i.y = c
i.z = d
assert i.z.s.y.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: D = None
        self.w: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: B = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

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

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

d.t = g
d.s = g
d.w = f
f.v = c
f.w = k
f.z = g
f.x = g
k.p = g
k.w = c
k.y = f
k.z = d
g.y = c
g.s = d
g.w = d
c.v = f
c.w = i
c.z = g
c.x = g
i.p = g
i.w = c
i.y = c
i.z = d
assert i.z.s.y.w.p.txt == "g"