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

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

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

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

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

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

g = A("g")
h = B("h")
l = C("l")
j = D("j")
b = E("b")
m = F("m")
i = C("i")
d = B("d")
c = B("c")

g.v = b
h.x = g
h.y = g
h.q = j
h.r = j
l.y = h
l.v = g
j.u = b
j.x = m
j.v = c
b.t = j
b.y = g
b.v = i
m.w = g
m.t = j
i.y = c
i.v = g
d.x = g
d.y = g
d.q = j
d.r = j
c.x = g
c.y = g
c.q = j
c.r = j
assert g.v.y.v.t.v.y.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

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

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

g = A("g")
h = B("h")
l = C("l")
j = D("j")
b = E("b")
m = F("m")
i = C("i")
d = B("d")
c = B("c")

g.v = b
h.x = g
h.y = g
h.q = j
h.r = j
l.y = h
l.v = g
j.u = b
j.x = m
j.v = c
b.t = j
b.y = g
b.v = i
m.w = g
m.t = j
i.y = c
i.v = g
d.x = g
d.y = g
d.q = j
d.r = j
c.x = g
c.y = g
c.q = j
c.r = j
assert g.v.y.v.t.v.y.v.t.txt == "j"