class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: E = None
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: D = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
l = C("l")
m = D("m")
f = E("f")
g = D("g")

i.x = h
i.s = f
i.q = m
h.v = f
h.w = m
l.v = i
l.z = f
l.q = g
m.u = l
m.z = h
m.x = i
m.t = i
f.o = h
g.u = l
g.z = h
g.x = i
g.t = i
assert i.x.v.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: E = None
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: D = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
l = C("l")
m = D("m")
f = E("f")
g = D("g")

i.x = h
i.s = f
i.q = m
h.v = f
h.w = m
l.v = i
l.z = f
l.q = g
m.u = l
m.z = h
m.x = i
m.t = i
f.o = h
g.u = l
g.z = h
g.x = i
g.t = i
assert i.x.v.o.w.txt == "m"