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

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: F = None
        self.t: E = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: E = None
        self.txt = txt

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

n.t = j
c.v = e
j.u = g
e.v = c
e.z = d
e.r = d
e.t = b
e.y = j
b.t = n
b.o = g
b.y = d
d.p = j
g.r = d
g.x = b
assert e.v.v.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: F = None
        self.t: E = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.x: E = None
        self.txt = txt

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

n.t = j
c.v = e
j.u = g
e.v = c
e.z = d
e.r = d
e.t = b
e.y = j
b.t = n
b.o = g
b.y = d
d.p = j
g.r = d
g.x = b
assert e.v.v.t.t.t.txt == "j"