class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: D = 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: A = None
        self.r: B = None
        self.z: F = None
        self.o: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: C = None
        self.y: C = None
        self.v: A = None
        self.s: F = None
        self.w: D = None
        self.txt = txt

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

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

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

d.t = a
d.x = n
h.q = l
g.v = d
g.r = h
g.z = b
g.o = b
n.p = a
l.t = n
l.w = n
l.u = g
l.y = g
l.v = d
l.s = b
b.p = l
a.z = g
a.r = g
a.p = l
a.x = b
assert l.s.p.v.x.p.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.x: D = 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: A = None
        self.r: B = None
        self.z: F = None
        self.o: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: C = None
        self.y: C = None
        self.v: A = None
        self.s: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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