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

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

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

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

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

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

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

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

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

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

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

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

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

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

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