class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: C = None
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: D = None
        self.o: D = None
        self.s: E = None
        self.x: E = None
        self.v: C = None
        self.txt = txt

a = A("a")
i = B("i")
c = C("c")
n = D("n")
f = E("f")
b = F("b")
d = G("d")

a.z = i
i.v = c
i.r = n
c.s = i
c.y = i
n.s = d
n.u = b
f.q = a
f.x = c
f.s = b
b.r = a
b.s = f
b.o = d
b.t = n
d.u = i
d.r = n
d.o = n
d.s = f
d.x = f
d.v = c
assert a.z.v.s.v.s.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: C = None
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: D = None
        self.o: D = None
        self.s: E = None
        self.x: E = None
        self.v: C = None
        self.txt = txt

a = A("a")
i = B("i")
c = C("c")
n = D("n")
f = E("f")
b = F("b")
d = G("d")

a.z = i
i.v = c
i.r = n
c.s = i
c.y = i
n.s = d
n.u = b
f.q = a
f.x = c
f.s = b
b.r = a
b.s = f
b.o = d
b.t = n
d.u = i
d.r = n
d.o = n
d.s = f
d.x = f
d.v = c
assert a.z.v.s.v.s.r.u.txt == "b"