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

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

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

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

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

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

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

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

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

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

g.z = c
g.r = c
m.z = g
i.w = c
i.v = c
i.t = m
i.p = m
c.t = k
c.y = d
c.z = g
b.w = d
b.v = d
b.t = m
b.p = m
k.z = c
k.r = d
l.w = c
l.v = c
l.t = m
l.p = m
d.t = g
d.z = g
d.y = c
e.w = c
e.t = m
e.p = m
e.v = d
n.w = d
n.v = d
n.t = m
n.p = m
assert d.z.z.y.t.r.y.z.z.txt == "c"