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

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

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

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

e = A("e")
n = B("n")
i = C("i")
f = D("f")
c = C("c")
k = D("k")
b = B("b")
g = A("g")
h = C("h")

e.z = f
n.w = e
n.r = c
n.t = b
n.o = f
i.x = k
i.w = h
i.t = e
f.q = g
f.y = i
c.x = f
c.w = h
c.t = e
k.q = e
k.y = h
b.w = e
b.r = h
b.t = n
b.o = k
g.z = f
h.x = f
h.w = i
h.t = g
assert e.z.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

e = A("e")
n = B("n")
i = C("i")
f = D("f")
c = C("c")
k = D("k")
b = B("b")
g = A("g")
h = C("h")

e.z = f
n.w = e
n.r = c
n.t = b
n.o = f
i.x = k
i.w = h
i.t = e
f.q = g
f.y = i
c.x = f
c.w = h
c.t = e
k.q = e
k.y = h
b.w = e
b.r = h
b.t = n
b.o = k
g.z = f
h.x = f
h.w = i
h.t = g
assert e.z.y.t.txt == "e"