class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

c.u = g
c.o = a
m.p = c
m.x = g
m.v = a
b.q = g
b.p = i
b.r = a
b.s = a
b.y = a
i.s = h
a.y = m
d.w = i
d.q = c
d.x = g
h.q = g
h.p = i
h.r = a
h.s = a
h.y = a
g.w = i
g.q = c
g.x = d
assert b.p.s.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

c.u = g
c.o = a
m.p = c
m.x = g
m.v = a
b.q = g
b.p = i
b.r = a
b.s = a
b.y = a
i.s = h
a.y = m
d.w = i
d.q = c
d.x = g
h.q = g
h.p = i
h.r = a
h.s = a
h.y = a
g.w = i
g.q = c
g.x = d
assert b.p.s.q.w.txt == "i"