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

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

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

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

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

i = A("i")
k = B("k")
l = C("l")
h = D("h")
b = E("b")
f = B("f")

i.x = h
i.q = h
i.w = h
k.q = f
k.o = f
k.r = i
k.v = i
l.u = f
h.x = k
h.u = l
b.s = h
b.q = h
f.q = k
f.o = k
f.r = i
f.v = i
assert f.r.x.u.u.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.q: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

i = A("i")
k = B("k")
l = C("l")
h = D("h")
b = E("b")
f = B("f")

i.x = h
i.q = h
i.w = h
k.q = f
k.o = f
k.r = i
k.v = i
l.u = f
h.x = k
h.u = l
b.s = h
b.q = h
f.q = k
f.o = k
f.r = i
f.v = i
assert f.r.x.u.u.q.o.txt == "f"