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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: A = None
        self.z: E = None
        self.txt = txt

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

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

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

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

f = A("f")
h = B("h")
g = C("g")
d = D("d")
e = E("e")
c = F("c")
i = E("i")

f.p = c
f.x = c
f.s = g
h.v = c
h.y = f
h.z = e
g.r = h
d.p = g
d.v = f
e.w = i
e.y = i
e.q = h
c.q = i
c.w = g
c.u = g
c.s = h
c.v = h
c.x = f
i.w = e
i.y = e
i.q = h
assert c.x.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.s: C = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: A = None
        self.z: E = None
        self.txt = txt

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

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

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

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

f = A("f")
h = B("h")
g = C("g")
d = D("d")
e = E("e")
c = F("c")
i = E("i")

f.p = c
f.x = c
f.s = g
h.v = c
h.y = f
h.z = e
g.r = h
d.p = g
d.v = f
e.w = i
e.y = i
e.q = h
c.q = i
c.w = g
c.u = g
c.s = h
c.v = h
c.x = f
i.w = e
i.y = e
i.q = h
assert c.x.x.q.txt == "i"