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

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

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

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

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

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

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

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

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

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

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