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

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

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

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

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

j = A("j")
g = B("g")
n = C("n")
m = D("m")
f = E("f")
c = A("c")
i = E("i")
h = C("h")
e = B("e")

j.z = e
j.r = c
g.t = e
n.v = h
n.s = h
n.o = g
n.r = f
n.x = c
m.r = c
m.z = c
f.t = c
c.z = e
c.r = j
i.t = j
h.v = n
h.s = n
h.o = e
h.r = i
h.x = j
e.t = g
assert i.t.z.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: A = None
        self.txt = txt

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

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

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

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

j = A("j")
g = B("g")
n = C("n")
m = D("m")
f = E("f")
c = A("c")
i = E("i")
h = C("h")
e = B("e")

j.z = e
j.r = c
g.t = e
n.v = h
n.s = h
n.o = g
n.r = f
n.x = c
m.r = c
m.z = c
f.t = c
c.z = e
c.r = j
i.t = j
h.v = n
h.s = n
h.o = e
h.r = i
h.x = j
e.t = g
assert i.t.z.t.t.txt == "e"