class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: A = None
        self.p: C = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: B = 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.y: C = None
        self.o: B = None
        self.txt = txt

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

e.u = g
e.z = g
e.p = i
e.s = i
m.y = c
m.t = h
i.x = e
n.y = i
n.o = m
h.y = c
h.t = m
j.y = i
j.o = m
g.u = e
g.z = e
g.p = i
g.s = i
c.y = i
c.o = h
assert i.x.u.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.z: A = None
        self.p: C = None
        self.s: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: B = 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.y: C = None
        self.o: B = None
        self.txt = txt

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

e.u = g
e.z = g
e.p = i
e.s = i
m.y = c
m.t = h
i.x = e
n.y = i
n.o = m
h.y = c
h.t = m
j.y = i
j.o = m
g.u = e
g.z = e
g.p = i
g.s = i
c.y = i
c.o = h
assert i.x.u.s.x.txt == "e"