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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: A = None
        self.x: E = None
        self.p: A = None
        self.s: B = None
        self.u: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: C = None
        self.o: A = None
        self.s: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: A = None
        self.x: E = None
        self.p: A = None
        self.s: B = None
        self.u: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: C = None
        self.o: A = None
        self.s: E = None
        self.txt = txt

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

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