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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: F = None
        self.z: C = None
        self.txt = txt

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

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

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

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

n = A("n")
b = B("b")
h = C("h")
i = D("i")
l = E("l")
f = F("f")
c = E("c")
g = D("g")
d = A("d")
m = C("m")

n.q = f
n.t = b
b.w = g
b.x = f
b.z = h
h.q = f
h.v = g
h.p = n
i.q = g
l.w = g
l.o = b
f.v = i
f.u = g
c.w = i
c.o = b
g.q = i
d.q = f
d.t = b
m.q = f
m.v = i
m.p = d
assert c.o.z.p.q.u.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.x: F = None
        self.z: C = None
        self.txt = txt

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

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

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

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

n = A("n")
b = B("b")
h = C("h")
i = D("i")
l = E("l")
f = F("f")
c = E("c")
g = D("g")
d = A("d")
m = C("m")

n.q = f
n.t = b
b.w = g
b.x = f
b.z = h
h.q = f
h.v = g
h.p = n
i.q = g
l.w = g
l.o = b
f.v = i
f.u = g
c.w = i
c.o = b
g.q = i
d.q = f
d.t = b
m.q = f
m.v = i
m.p = d
assert c.o.z.p.q.u.q.q.q.q.q.txt == "i"