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

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: A = None
        self.q: C = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.v: D = None
        self.r: D = None
        self.txt = txt

i = A("i")
n = B("n")
j = C("j")
l = D("l")
b = C("b")
g = D("g")
h = B("h")

i.q = g
i.y = h
n.v = g
n.t = j
j.p = h
j.x = i
j.q = b
j.v = g
l.s = g
l.p = g
l.v = g
l.r = g
b.p = h
b.x = i
b.q = j
b.v = l
g.s = l
g.p = l
g.v = l
g.r = l
h.v = l
h.t = b
assert n.t.p.t.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: A = None
        self.q: C = None
        self.v: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: D = None
        self.v: D = None
        self.r: D = None
        self.txt = txt

i = A("i")
n = B("n")
j = C("j")
l = D("l")
b = C("b")
g = D("g")
h = B("h")

i.q = g
i.y = h
n.v = g
n.t = j
j.p = h
j.x = i
j.q = b
j.v = g
l.s = g
l.p = g
l.v = g
l.r = g
b.p = h
b.x = i
b.q = j
b.v = l
g.s = l
g.p = l
g.v = l
g.r = l
h.v = l
h.t = b
assert n.t.p.t.q.v.txt == "g"