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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: G = None
        self.r: A = None
        self.u: E = None
        self.z: D = None
        self.txt = txt

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

d = A("d")
g = B("g")
k = C("k")
m = D("m")
j = E("j")
e = F("e")
c = G("c")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: G = None
        self.r: A = None
        self.u: E = None
        self.z: D = None
        self.txt = txt

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

d = A("d")
g = B("g")
k = C("k")
m = D("m")
j = E("j")
e = F("e")
c = G("c")

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