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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: E = None
        self.o: F = None
        self.s: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

b.z = i
b.p = h
b.o = g
g.p = h
g.v = h
g.o = m
g.q = m
g.s = i
c.y = b
i.o = b
i.y = m
i.x = m
i.q = h
h.y = i
h.r = b
h.q = c
h.t = g
h.p = j
j.p = g
j.x = g
m.p = g
m.x = g
assert b.o.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.p: E = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: E = None
        self.o: F = None
        self.s: D = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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