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

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: A = None
        self.p: F = None
        self.o: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: F = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: E = None
        self.u: A = None
        self.o: A = None
        self.txt = txt

a = A("a")
g = B("g")
d = C("d")
m = D("m")
l = E("l")
f = F("f")
n = C("n")

a.v = d
a.p = g
g.v = m
g.q = m
g.z = d
g.s = d
g.w = n
g.r = l
d.r = f
d.p = f
d.x = a
d.o = n
m.p = g
m.q = g
m.x = a
l.q = a
l.w = f
l.y = f
f.x = l
f.q = l
f.u = a
f.o = a
n.r = f
n.p = f
n.x = a
n.o = d
assert a.v.o.o.o.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: A = None
        self.p: F = None
        self.o: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.w: F = None
        self.y: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.q: E = None
        self.u: A = None
        self.o: A = None
        self.txt = txt

a = A("a")
g = B("g")
d = C("d")
m = D("m")
l = E("l")
f = F("f")
n = C("n")

a.v = d
a.p = g
g.v = m
g.q = m
g.z = d
g.s = d
g.w = n
g.r = l
d.r = f
d.p = f
d.x = a
d.o = n
m.p = g
m.q = g
m.x = a
l.q = a
l.w = f
l.y = f
f.x = l
f.q = l
f.u = a
f.o = a
n.r = f
n.p = f
n.x = a
n.o = d
assert a.v.o.o.o.x.p.txt == "g"