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

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

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

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

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

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

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

d.z = c
f.p = g
c.q = a
c.o = d
c.r = d
c.y = f
c.x = k
c.w = k
h.y = d
h.u = g
j.q = c
j.t = a
k.q = g
k.u = g
k.z = j
k.s = d
k.t = c
m.p = a
g.y = d
g.u = h
a.y = d
a.u = g
assert g.y.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

d.z = c
f.p = g
c.q = a
c.o = d
c.r = d
c.y = f
c.x = k
c.w = k
h.y = d
h.u = g
j.q = c
j.t = a
k.q = g
k.u = g
k.z = j
k.s = d
k.t = c
m.p = a
g.y = d
g.u = h
a.y = d
a.u = g
assert g.y.z.o.z.txt == "c"