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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

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

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

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