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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.q: E = None
        self.p: F = None
        self.r: E = None
        self.o: E = None
        self.x: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.q: E = None
        self.p: F = None
        self.r: E = None
        self.o: E = None
        self.x: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

f.x = d
f.v = d
f.r = c
f.u = h
f.z = a
c.z = g
c.p = g
c.x = g
c.q = d
c.r = d
c.o = d
h.q = f
h.y = g
h.w = d
h.x = d
h.p = c
a.y = f
a.r = g
a.q = g
a.w = g
a.u = c
d.y = c
d.o = f
d.w = g
g.u = c
assert h.q.r.q.w.txt == "g"