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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: A = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.x: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: A = None
        self.w: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: A = None
        self.x: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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