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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: E = None
        self.s: D = None
        self.z: D = 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.p: F = None
        self.o: F = None
        self.x: C = None
        self.w: B = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
a = C("a")
e = D("e")
b = E("b")
i = F("i")
h = F("h")

c.p = e
c.z = g
c.o = g
c.w = a
c.q = a
g.r = b
g.y = b
g.s = e
g.z = e
a.y = c
e.p = i
e.o = i
e.x = a
e.w = g
b.p = g
i.y = a
i.r = e
i.t = b
i.u = h
i.w = c
h.y = a
h.r = e
h.t = b
h.u = i
h.w = c
assert c.q.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.o: B = None
        self.w: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: E = None
        self.s: D = None
        self.z: D = 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.p: F = None
        self.o: F = None
        self.x: C = None
        self.w: B = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
a = C("a")
e = D("e")
b = E("b")
i = F("i")
h = F("h")

c.p = e
c.z = g
c.o = g
c.w = a
c.q = a
g.r = b
g.y = b
g.s = e
g.z = e
a.y = c
e.p = i
e.o = i
e.x = a
e.w = g
b.p = g
i.y = a
i.r = e
i.t = b
i.u = h
i.w = c
h.y = a
h.r = e
h.t = b
h.u = i
h.w = c
assert c.q.y.q.y.txt == "c"