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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: A = None
        self.v: C = None
        self.s: C = None
        self.w: A = None
        self.txt = txt

d = A("d")
c = B("c")
k = C("k")
n = D("n")
j = E("j")
h = E("h")
m = B("m")

d.z = k
c.v = m
c.t = m
c.z = n
c.x = d
k.q = n
k.t = d
k.y = d
n.p = k
n.v = c
j.t = d
j.r = d
j.w = d
j.v = k
j.s = k
h.t = d
h.r = d
h.w = d
h.v = k
h.s = k
m.v = c
m.t = c
m.z = n
m.x = d
assert n.p.t.z.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: A = None
        self.v: C = None
        self.s: C = None
        self.w: A = None
        self.txt = txt

d = A("d")
c = B("c")
k = C("k")
n = D("n")
j = E("j")
h = E("h")
m = B("m")

d.z = k
c.v = m
c.t = m
c.z = n
c.x = d
k.q = n
k.t = d
k.y = d
n.p = k
n.v = c
j.t = d
j.r = d
j.w = d
j.v = k
j.s = k
h.t = d
h.r = d
h.w = d
h.v = k
h.s = k
m.v = c
m.t = c
m.z = n
m.x = d
assert n.p.t.z.y.z.y.txt == "d"