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

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

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

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

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

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

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

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

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

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

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