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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: B = None
        self.txt = txt

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

b = A("b")
d = B("d")
n = C("n")
i = D("i")
c = A("c")
e = D("e")
k = B("k")
a = B("a")
f = D("f")

b.o = c
b.p = c
b.z = n
d.u = c
d.p = c
d.w = f
n.v = c
n.s = k
i.p = n
i.y = e
i.t = d
c.o = b
c.p = b
c.z = n
e.p = n
e.y = f
e.t = a
k.u = c
k.p = c
k.w = e
a.u = b
a.p = b
a.w = i
f.p = n
f.y = e
f.t = d
assert n.v.o.o.p.p.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: C = None
        self.p: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: B = None
        self.txt = txt

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

b = A("b")
d = B("d")
n = C("n")
i = D("i")
c = A("c")
e = D("e")
k = B("k")
a = B("a")
f = D("f")

b.o = c
b.p = c
b.z = n
d.u = c
d.p = c
d.w = f
n.v = c
n.s = k
i.p = n
i.y = e
i.t = d
c.o = b
c.p = b
c.z = n
e.p = n
e.y = f
e.t = a
k.u = c
k.p = c
k.w = e
a.u = b
a.p = b
a.w = i
f.p = n
f.y = e
f.t = d
assert n.v.o.o.p.p.z.v.txt == "c"