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

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

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

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

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

m.z = n
m.u = n
m.t = h
m.r = d
b.p = m
h.y = n
h.u = d
h.v = c
n.y = c
n.t = c
c.y = f
c.u = g
c.v = h
g.z = n
g.u = n
g.t = h
g.r = d
f.y = h
f.t = h
i.p = k
d.z = f
d.u = n
d.t = h
d.r = g
k.z = f
k.u = f
k.t = h
k.r = m
assert n.y.y.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.t: C = None
        self.r: A = None
        self.txt = txt

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

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

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

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

m.z = n
m.u = n
m.t = h
m.r = d
b.p = m
h.y = n
h.u = d
h.v = c
n.y = c
n.t = c
c.y = f
c.u = g
c.v = h
g.z = n
g.u = n
g.t = h
g.r = d
f.y = h
f.t = h
i.p = k
d.z = f
d.u = n
d.t = h
d.r = g
k.z = f
k.u = f
k.t = h
k.r = m
assert n.y.y.y.v.txt == "c"