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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.s: D = None
        self.txt = txt

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

a = A("a")
k = B("k")
g = C("g")
d = D("d")
h = E("h")
e = F("e")

a.v = k
a.r = g
k.w = h
k.q = h
k.z = g
g.t = a
g.s = e
g.x = d
d.u = g
d.w = a
h.t = k
h.o = k
h.s = d
e.y = h
e.q = d
e.x = g
assert h.o.q.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.s: D = None
        self.txt = txt

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

a = A("a")
k = B("k")
g = C("g")
d = D("d")
h = E("h")
e = F("e")

a.v = k
a.r = g
k.w = h
k.q = h
k.z = g
g.t = a
g.s = e
g.x = d
d.u = g
d.w = a
h.t = k
h.o = k
h.s = d
e.y = h
e.q = d
e.x = g
assert h.o.q.s.u.txt == "g"