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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: D = None
        self.v: F = None
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: D = None
        self.v: F = None
        self.p: D = None
        self.y: A = None
        self.txt = txt

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

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