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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.v: A = None
        self.w: C = None
        self.z: E = None
        self.txt = txt

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

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

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

d = A("d")
e = B("e")
f = C("f")
j = D("j")
n = E("n")
c = E("c")
h = C("h")

d.o = j
e.t = h
e.w = h
e.u = d
e.v = d
e.z = c
f.w = h
f.t = h
f.z = h
f.v = j
f.s = d
j.y = n
j.t = c
n.p = h
n.v = e
n.t = c
c.p = h
c.v = e
c.t = n
h.w = f
h.t = f
h.z = f
h.v = j
h.s = d
assert d.o.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: A = None
        self.v: A = None
        self.w: C = None
        self.z: E = None
        self.txt = txt

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

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

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

d = A("d")
e = B("e")
f = C("f")
j = D("j")
n = E("n")
c = E("c")
h = C("h")

d.o = j
e.t = h
e.w = h
e.u = d
e.v = d
e.z = c
f.w = h
f.t = h
f.z = h
f.v = j
f.s = d
j.y = n
j.t = c
n.p = h
n.v = e
n.t = c
c.p = h
c.v = e
c.t = n
h.w = f
h.t = f
h.z = f
h.v = j
h.s = d
assert d.o.t.t.t.txt == "c"