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

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

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

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

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

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

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

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

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

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

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

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

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