class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: E = None
        self.t: E = None
        self.u: D = None
        self.y: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: E = None
        self.t: E = None
        self.u: D = None
        self.y: D = None
        self.o: B = None
        self.txt = txt

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

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