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

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.u: D = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: C = None
        self.w: B = None
        self.t: E = None
        self.s: C = None
        self.txt = txt

n = A("n")
m = B("m")
j = C("j")
d = D("d")
c = E("c")
g = F("g")
f = F("f")

n.q = m
m.y = d
m.p = d
m.o = c
j.s = n
j.y = d
j.z = d
j.o = d
j.t = c
d.s = g
c.p = m
c.z = m
c.u = d
c.s = g
g.p = n
g.v = j
g.s = j
g.w = m
g.t = c
f.p = n
f.v = j
f.s = j
f.w = m
f.t = c
assert d.s.v.t.s.p.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.u: D = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: C = None
        self.w: B = None
        self.t: E = None
        self.s: C = None
        self.txt = txt

n = A("n")
m = B("m")
j = C("j")
d = D("d")
c = E("c")
g = F("g")
f = F("f")

n.q = m
m.y = d
m.p = d
m.o = c
j.s = n
j.y = d
j.z = d
j.o = d
j.t = c
d.s = g
c.p = m
c.z = m
c.u = d
c.s = g
g.p = n
g.v = j
g.s = j
g.w = m
g.t = c
f.p = n
f.v = j
f.s = j
f.w = m
f.t = c
assert d.s.v.t.s.p.q.y.txt == "d"