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

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: D = None
        self.p: E = None
        self.y: E = None
        self.txt = txt

g = A("g")
f = B("f")
b = C("b")
e = D("e")
c = E("c")
l = F("l")
j = G("j")
a = H("a")

g.q = l
f.v = b
f.r = l
b.q = j
e.w = a
e.x = c
c.z = l
c.p = e
c.y = e
l.q = b
l.r = c
l.x = j
j.p = e
a.v = l
a.t = e
a.p = c
a.y = c
assert b.q.p.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: D = None
        self.p: E = None
        self.y: E = None
        self.txt = txt

g = A("g")
f = B("f")
b = C("b")
e = D("e")
c = E("c")
l = F("l")
j = G("j")
a = H("a")

g.q = l
f.v = b
f.r = l
b.q = j
e.w = a
e.x = c
c.z = l
c.p = e
c.y = e
l.q = b
l.r = c
l.x = j
j.p = e
a.v = l
a.t = e
a.p = c
a.y = c
assert b.q.p.x.z.txt == "l"