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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
l = C("l")
a = D("a")
c = E("c")
h = E("h")
b = E("b")
g = A("g")

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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
l = C("l")
a = D("a")
c = E("c")
h = E("h")
b = E("b")
g = A("g")

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