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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: F = None
        self.z: C = None
        self.p: E = None
        self.s: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: F = None
        self.t: E = None
        self.y: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: F = None
        self.z: C = None
        self.p: E = None
        self.s: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: F = None
        self.t: E = None
        self.y: E = None
        self.txt = txt

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

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