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

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

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

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

c = A("c")
n = B("n")
e = C("e")
i = D("i")
k = C("k")
j = A("j")
h = B("h")
g = B("g")

c.t = j
c.z = e
n.r = c
n.w = c
n.x = e
n.v = g
e.z = n
i.w = g
i.y = n
i.u = k
k.z = g
j.t = c
j.z = k
h.r = j
h.x = e
h.w = c
h.v = g
g.r = c
g.w = c
g.x = e
g.v = n
assert i.w.v.w.z.z.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: C = None
        self.txt = txt

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

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

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

c = A("c")
n = B("n")
e = C("e")
i = D("i")
k = C("k")
j = A("j")
h = B("h")
g = B("g")

c.t = j
c.z = e
n.r = c
n.w = c
n.x = e
n.v = g
e.z = n
i.w = g
i.y = n
i.u = k
k.z = g
j.t = c
j.z = k
h.r = j
h.x = e
h.w = c
h.v = g
g.r = c
g.w = c
g.x = e
g.v = n
assert i.w.v.w.z.z.w.t.txt == "j"