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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: D = None
        self.o: E = None
        self.r: A = None
        self.txt = txt

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

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

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

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

f.z = e
k.u = h
k.o = h
k.t = e
k.r = f
i.x = f
e.p = k
e.w = f
e.t = g
m.t = f
a.x = f
j.p = k
j.w = f
j.t = g
g.x = f
h.t = f
assert e.t.x.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: D = None
        self.o: E = None
        self.r: A = None
        self.txt = txt

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

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

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

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

f.z = e
k.u = h
k.o = h
k.t = e
k.r = f
i.x = f
e.p = k
e.w = f
e.t = g
m.t = f
a.x = f
j.p = k
j.w = f
j.t = g
g.x = f
h.t = f
assert e.t.x.z.t.txt == "g"