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

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: F = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: F = None
        self.s: G = None
        self.v: G = None
        self.p: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: F = None
        self.txt = txt

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

f.r = d
f.v = i
k.z = d
k.o = d
k.v = i
k.p = i
i.x = g
i.s = c
g.o = c
g.z = c
g.p = i
b.w = f
b.z = c
b.s = d
b.v = d
b.p = k
c.y = i
d.q = i
d.y = c
a.z = d
a.o = d
a.v = i
a.p = i
assert i.x.p.x.p.s.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: F = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: F = None
        self.s: G = None
        self.v: G = None
        self.p: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: F = None
        self.txt = txt

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

f.r = d
f.v = i
k.z = d
k.o = d
k.v = i
k.p = i
i.x = g
i.s = c
g.o = c
g.z = c
g.p = i
b.w = f
b.z = c
b.s = d
b.v = d
b.p = k
c.y = i
d.q = i
d.y = c
a.z = d
a.o = d
a.v = i
a.p = i
assert i.x.p.x.p.s.y.s.y.txt == "i"