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

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

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

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

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

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

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

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

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

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

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

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

b.o = l
b.x = l
b.q = f
b.r = f
d.v = h
f.v = l
f.w = i
l.y = i
l.s = i
l.u = f
i.s = h
i.t = l
h.v = d
c.o = l
c.x = l
c.q = f
c.r = f
assert h.v.v.v.v.txt == "h"