class A:
    def __init__(self, txt: str):
        self.p: F = 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.x: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

a.p = g
h.q = e
d.x = j
l.z = e
e.v = b
g.v = l
b.y = h
b.x = e
b.v = l
b.u = j
j.x = d
assert h.q.v.u.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = 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.x: C = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

a.p = g
h.q = e
d.x = j
l.z = e
e.v = b
g.v = l
b.y = h
b.x = e
b.v = l
b.u = j
j.x = d
assert h.q.v.u.x.x.x.x.txt == "j"