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

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: B = None
        self.x: B = None
        self.v: C = None
        self.y: A = 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.w: B = None
        self.txt = txt

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

k.y = d
i.u = e
e.x = g
e.t = i
g.u = f
f.v = n
f.p = n
f.q = e
d.q = n
d.w = i
d.x = i
d.v = e
d.y = k
n.p = g
j.w = i
assert g.u.q.x.u.q.x.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: B = None
        self.x: B = None
        self.v: C = None
        self.y: A = 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.w: B = None
        self.txt = txt

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

k.y = d
i.u = e
e.x = g
e.t = i
g.u = f
f.v = n
f.p = n
f.q = e
d.q = n
d.w = i
d.x = i
d.v = e
d.y = k
n.p = g
j.w = i
assert g.u.q.x.u.q.x.u.v.txt == "n"