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

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

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.w: E = None
        self.q: A = None
        self.p: D = None
        self.y: B = None
        self.v: H = None
        self.x: H = None
        self.z: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: G = None
        self.v: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: H = None
        self.w: E = None
        self.q: A = None
        self.p: D = None
        self.y: B = None
        self.v: H = None
        self.x: H = None
        self.z: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: G = None
        self.v: E = None
        self.w: E = None
        self.txt = txt

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

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

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

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