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

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

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

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

k = A("k")
h = B("h")
d = C("d")
f = D("f")
n = D("n")
i = D("i")
g = D("g")
l = A("l")
b = B("b")

k.x = d
k.v = l
k.y = n
h.x = d
h.w = d
d.z = i
f.o = b
f.x = l
n.o = b
n.x = k
i.o = h
i.x = k
g.o = b
g.x = k
l.x = d
l.v = k
l.y = i
b.x = d
b.w = d
assert n.x.v.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: A = None
        self.y: D = None
        self.txt = txt

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

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

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

k = A("k")
h = B("h")
d = C("d")
f = D("f")
n = D("n")
i = D("i")
g = D("g")
l = A("l")
b = B("b")

k.x = d
k.v = l
k.y = n
h.x = d
h.w = d
d.z = i
f.o = b
f.x = l
n.o = b
n.x = k
i.o = h
i.x = k
g.o = b
g.x = k
l.x = d
l.v = k
l.y = i
b.x = d
b.w = d
assert n.x.v.y.x.txt == "k"