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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: D = None
        self.u: C = None
        self.txt = txt

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

g.y = l
g.u = i
k.w = l
k.z = h
l.r = a
l.o = n
l.q = n
m.w = k
e.y = i
e.u = i
e.t = m
j.y = i
j.u = i
j.t = m
h.y = i
h.u = i
a.w = i
a.z = h
n.y = l
n.u = i
i.r = a
i.o = h
i.q = n
assert j.t.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: D = None
        self.u: C = None
        self.txt = txt

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

g.y = l
g.u = i
k.w = l
k.z = h
l.r = a
l.o = n
l.q = n
m.w = k
e.y = i
e.u = i
e.t = m
j.y = i
j.u = i
j.t = m
h.y = i
h.u = i
a.w = i
a.z = h
n.y = l
n.u = i
i.r = a
i.o = h
i.q = n
assert j.t.w.w.txt == "l"