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

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

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

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

b = A("b")
h = B("h")
n = C("n")
i = D("i")
l = B("l")
g = C("g")
j = D("j")
e = D("e")

b.w = l
b.r = h
h.t = e
h.q = b
n.x = l
n.y = h
n.p = g
n.t = b
i.z = e
i.v = l
i.q = h
l.t = j
l.q = b
g.x = h
g.y = l
g.p = n
g.t = b
j.z = e
j.v = h
j.q = l
e.z = j
e.v = h
e.q = h
assert n.y.t.z.z.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: B = None
        self.txt = txt

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

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

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

b = A("b")
h = B("h")
n = C("n")
i = D("i")
l = B("l")
g = C("g")
j = D("j")
e = D("e")

b.w = l
b.r = h
h.t = e
h.q = b
n.x = l
n.y = h
n.p = g
n.t = b
i.z = e
i.v = l
i.q = h
l.t = j
l.q = b
g.x = h
g.y = l
g.p = n
g.t = b
j.z = e
j.v = h
j.q = l
e.z = j
e.v = h
e.q = h
assert n.y.t.z.z.v.q.txt == "b"