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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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