class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: D = None
        self.z: D = None
        self.v: E = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: F = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: B = None
        self.w: D = None
        self.x: F = None
        self.r: C = None
        self.txt = txt

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

j = A("j")
k = B("k")
e = C("e")
h = D("h")
d = E("d")
g = F("g")
c = E("c")

j.u = e
j.r = h
j.z = h
j.v = d
j.q = g
k.r = g
k.s = g
k.q = h
k.o = j
e.u = h
h.s = g
h.y = g
h.q = e
d.u = g
d.x = g
d.q = k
d.w = h
d.r = e
g.y = d
c.u = g
c.x = g
c.q = k
c.w = h
c.r = e
assert h.q.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: D = None
        self.z: D = None
        self.v: E = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: F = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: B = None
        self.w: D = None
        self.x: F = None
        self.r: C = None
        self.txt = txt

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

j = A("j")
k = B("k")
e = C("e")
h = D("h")
d = E("d")
g = F("g")
c = E("c")

j.u = e
j.r = h
j.z = h
j.v = d
j.q = g
k.r = g
k.s = g
k.q = h
k.o = j
e.u = h
h.s = g
h.y = g
h.q = e
d.u = g
d.x = g
d.q = k
d.w = h
d.r = e
g.y = d
c.u = g
c.x = g
c.q = k
c.w = h
c.r = e
assert h.q.u.y.txt == "g"