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

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: B = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

c.r = i
c.x = h
c.o = l
d.v = f
f.o = l
f.w = l
f.v = d
n.q = c
n.p = c
n.o = g
n.v = i
i.z = n
b.s = f
l.x = f
h.v = f
g.q = c
g.p = c
g.o = n
g.v = i
assert i.z.p.x.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: B = None
        self.o: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.v: B = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

c.r = i
c.x = h
c.o = l
d.v = f
f.o = l
f.w = l
f.v = d
n.q = c
n.p = c
n.o = g
n.v = i
i.z = n
b.s = f
l.x = f
h.v = f
g.q = c
g.p = c
g.o = n
g.v = i
assert i.z.p.x.v.v.txt == "d"