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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: D = None
        self.z: A = None
        self.x: E = None
        self.o: A = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
g = C("g")
l = D("l")
n = E("n")
f = C("f")
d = E("d")
j = D("j")

e.q = l
b.t = d
b.r = l
b.z = e
b.o = e
b.x = n
g.v = l
l.y = b
l.v = f
n.t = l
f.v = l
d.t = j
j.y = b
j.v = f
assert d.t.v.v.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: D = None
        self.z: A = None
        self.x: E = None
        self.o: A = None
        self.txt = txt

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

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

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

e = A("e")
b = B("b")
g = C("g")
l = D("l")
n = E("n")
f = C("f")
d = E("d")
j = D("j")

e.q = l
b.t = d
b.r = l
b.z = e
b.o = e
b.x = n
g.v = l
l.y = b
l.v = f
n.t = l
f.v = l
d.t = j
j.y = b
j.v = f
assert d.t.v.v.y.o.txt == "e"