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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: E = None
        self.y: C = None
        self.w: D = None
        self.x: C = None
        self.txt = txt

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

f = A("f")
l = B("l")
a = C("a")
c = D("c")
e = E("e")
j = C("j")
i = D("i")
h = E("h")

f.q = i
f.z = h
f.w = j
l.w = j
l.o = i
l.q = f
a.q = f
a.y = l
c.u = l
c.o = h
c.y = a
c.w = i
c.x = j
e.q = j
j.q = f
j.y = l
i.u = l
i.o = h
i.y = a
i.w = c
i.x = j
h.q = j
assert j.q.q.u.q.w.y.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.z: E = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: E = None
        self.y: C = None
        self.w: D = None
        self.x: C = None
        self.txt = txt

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

f = A("f")
l = B("l")
a = C("a")
c = D("c")
e = E("e")
j = C("j")
i = D("i")
h = E("h")

f.q = i
f.z = h
f.w = j
l.w = j
l.o = i
l.q = f
a.q = f
a.y = l
c.u = l
c.o = h
c.y = a
c.w = i
c.x = j
e.q = j
j.q = f
j.y = l
i.u = l
i.o = h
i.y = a
i.w = c
i.x = j
h.q = j
assert j.q.q.u.q.w.y.q.w.txt == "j"