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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: B = None
        self.p: B = None
        self.v: A = None
        self.w: D = None
        self.txt = txt

f = A("f")
g = B("g")
b = C("b")
c = D("c")
h = E("h")
k = F("k")

f.x = g
f.z = g
f.q = g
f.v = g
f.s = h
f.u = h
g.r = c
g.w = k
g.o = k
b.s = g
c.p = h
h.o = f
h.u = g
h.p = c
k.x = g
k.u = g
k.p = g
k.v = f
k.w = c
assert k.v.v.r.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: B = None
        self.q: B = None
        self.s: E = None
        self.u: E = None
        self.v: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: B = None
        self.p: B = None
        self.v: A = None
        self.w: D = None
        self.txt = txt

f = A("f")
g = B("g")
b = C("b")
c = D("c")
h = E("h")
k = F("k")

f.x = g
f.z = g
f.q = g
f.v = g
f.s = h
f.u = h
g.r = c
g.w = k
g.o = k
b.s = g
c.p = h
h.o = f
h.u = g
h.p = c
k.x = g
k.u = g
k.p = g
k.v = f
k.w = c
assert k.v.v.r.p.u.txt == "g"