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

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

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

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

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

n.z = c
n.o = g
a.u = g
a.s = g
a.z = c
c.x = g
c.r = k
c.v = h
g.z = i
g.v = c
g.y = c
i.u = g
i.s = g
i.z = c
k.z = c
k.o = g
h.z = c
h.o = g
assert i.u.v.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

n.z = c
n.o = g
a.u = g
a.s = g
a.z = c
c.x = g
c.r = k
c.v = h
g.z = i
g.v = c
g.y = c
i.u = g
i.s = g
i.z = c
k.z = c
k.o = g
h.z = c
h.o = g
assert i.u.v.x.v.txt == "c"