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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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