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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: A = None
        self.y: B = None
        self.t: D = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.p: A = None
        self.u: A = None
        self.z: C = None
        self.txt = txt

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

h.o = l
h.r = i
h.v = i
l.o = i
c.v = h
c.z = h
c.y = l
c.t = i
c.w = f
i.x = h
i.v = h
i.u = l
g.y = l
g.t = b
g.p = h
g.u = h
g.z = c
f.y = l
f.t = b
f.z = b
f.p = h
f.u = h
b.v = h
b.z = h
b.y = l
b.t = i
b.w = g
assert b.w.z.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: D = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: A = None
        self.y: B = None
        self.t: D = None
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.p: A = None
        self.u: A = None
        self.z: C = None
        self.txt = txt

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

h.o = l
h.r = i
h.v = i
l.o = i
c.v = h
c.z = h
c.y = l
c.t = i
c.w = f
i.x = h
i.v = h
i.u = l
g.y = l
g.t = b
g.p = h
g.u = h
g.z = c
f.y = l
f.t = b
f.z = b
f.p = h
f.u = h
b.v = h
b.z = h
b.y = l
b.t = i
b.w = g
assert b.w.z.y.o.txt == "i"