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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.x: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.q: F = None
        self.y: C = None
        self.t: A = None
        self.txt = txt

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

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

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

c.q = j
g.v = b
g.t = b
g.y = d
g.z = c
g.w = c
g.o = j
m.t = c
m.z = c
m.x = c
d.r = j
d.y = j
d.w = m
d.q = i
d.t = c
n.q = d
n.w = d
n.v = d
n.z = d
i.v = n
b.t = c
b.z = c
b.x = c
j.t = c
j.z = c
j.x = c
h.q = d
h.w = d
h.v = d
h.z = d
assert n.v.t.q.t.q.z.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.x: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.q: F = None
        self.y: C = None
        self.t: A = None
        self.txt = txt

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

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

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

c.q = j
g.v = b
g.t = b
g.y = d
g.z = c
g.w = c
g.o = j
m.t = c
m.z = c
m.x = c
d.r = j
d.y = j
d.w = m
d.q = i
d.t = c
n.q = d
n.w = d
n.v = d
n.z = d
i.v = n
b.t = c
b.z = c
b.x = c
j.t = c
j.z = c
j.x = c
h.q = d
h.w = d
h.v = d
h.z = d
assert n.v.t.q.t.q.z.q.t.txt == "c"